Yoast\WP\SEO\Presenters

Robots_Txt_Presenter::add_directive_path()privateYoast 1.0

Adds user agent directives path content to the robots txt output string.

@param string $robots_txt_content The current working robots txt string. @param array $paths The list of paths for which to add a txt entry. @param string $directive_identifier The identifier for the directives. (Disallow of Allow).

@return string

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

Хуков нет.

Возвращает

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

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

// private - только в коде основоного (родительского) класса
$result = $this->add_directive_path( $robots_txt_content, $paths, $directive_identifier );
$robots_txt_content (обязательный)
-
$paths (обязательный)
-
$directive_identifier (обязательный)
-

Код Robots_Txt_Presenter::add_directive_path() Yoast 22.4

private function add_directive_path( $robots_txt_content, $paths, $directive_identifier ) {
	if ( \count( $paths ) > 0 ) {
		foreach ( $paths as $path ) {
			$robots_txt_content .= $directive_identifier . ': ' . $path . \PHP_EOL;
		}
	}

	return $robots_txt_content;
}