WP_Sitemaps::add_robots()publicWP 5.5.0

Adds the sitemap index to robots.txt.

Method of the class: WP_Sitemaps{}

No Hooks.

Return

String. The robots.txt output.

Usage

$WP_Sitemaps = new WP_Sitemaps();
$WP_Sitemaps->add_robots( $output, $is_ );
$output(string) (required)
robots.txt output.
$is_ (required)
-

Changelog

Since 5.5.0 Introduced.

WP_Sitemaps::add_robots() code WP 6.6.2

public function add_robots( $output, $is_public ) {
	if ( $is_public ) {
		$output .= "\nSitemap: " . esc_url( $this->index->get_index_url() ) . "\n";
	}

	return $output;
}