Yoast\WP\SEO\Helpers

Robots_Txt_Helper::add_disallow()publicYoast 1.0

Add a disallow rule for a specific user agent if it does not exist yet.

Метод класса: Robots_Txt_Helper{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$Robots_Txt_Helper = new Robots_Txt_Helper();
$Robots_Txt_Helper->add_disallow( $user_agent, $path );
$user_agent(строка) (обязательный)
The user agent to add the disallow rule to.
$path(строка) (обязательный)
The path to add as a disallow rule.

Код Robots_Txt_Helper::add_disallow() Yoast 22.4

public function add_disallow( $user_agent, $path ) {
	$user_agent_container = $this->robots_txt_user_agents->get_user_agent( $user_agent );
	$user_agent_container->add_disallow_directive( $path );
}