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

Adds the sitemap index to robots.txt.

Parameters Parameters


(string) (Required) robots.txt output.


(bool) (Required) Whether the site is public.

Top ↑

Return Return

(string) The robots.txt output.

Top ↑

Source Source

File: wp-includes/sitemaps/class-wp-sitemaps.php

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

		return $output;

Top ↑

Changelog Changelog

Version Description
5.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

Top ↑

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