Yoast\WP\SEO\Presenters
Robots_Txt_Presenter::add_user_agent_directives()
Adds user agent directives to the robots txt output string.
Метод класса: Robots_Txt_Presenter{}
Хуков нет.
Возвращает
Строку
.
Использование
// private - только в коде основоного (родительского) класса $result = $this->add_user_agent_directives( $user_agents, $robots_txt_content );
- $user_agents(массив) (обязательный)
- The list if available user agents.
- $robots_txt_content(строка) (обязательный)
- The current working robots txt string.
Код Robots_Txt_Presenter::add_user_agent_directives() Robots Txt Presenter::add user agent directives Yoast 24.1
private function add_user_agent_directives( $user_agents, $robots_txt_content ) { foreach ( $user_agents as $user_agent ) { $robots_txt_content .= self::USER_AGENT_FIELD . ': ' . $user_agent->get_user_agent() . \PHP_EOL; $robots_txt_content = $this->add_directive_path( $robots_txt_content, $user_agent->get_disallow_paths(), self::DISALLOW_DIRECTIVE ); $robots_txt_content = $this->add_directive_path( $robots_txt_content, $user_agent->get_allow_paths(), self::ALLOW_DIRECTIVE ); $robots_txt_content .= \PHP_EOL; } return $robots_txt_content; }