WP_Sitemaps::add_robots( string $output, bool $is_public ): string

In this article

Adds the sitemap index to robots.txt.

Parameters

$outputstringrequired
robots.txt output.
$is_publicboolrequired
Whether the site is public.

Return

string The robots.txt output.

Source

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

	return $output;
}

Changelog

VersionDescription
5.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.