wppaste
WordPress

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

Since
5.5.0
Source
wp-includes/sitemaps/class-wp-sitemaps.php:259
Adds the sitemap index to robots.txt.

Parameters

$outputstring
robots.txt output.
$is_publicbool
Whether the site is public.

Return

string
The robots.txt output.

Uses · 1

Source

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

History

Introduced in 5.5.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 tag, from src/wp-includes/sitemaps/class-wp-sitemaps.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.