On this page
WP_Sitemaps::add_robots( string $output, bool $public ): string
Adds the sitemap index to robots.txt.
Parameters
$outputstring Required-
robots.txt output.
$publicbool Required-
Whether the site is public.
Return
string The robots.txt output.
Source
File: wp-includes/sitemaps/class-wp-sitemaps.php. View all references
public function add_robots( $output, $public ) {
if ( $public ) {
$output .= "\nSitemap: " . esc_url( $this->index->get_index_url() ) . "\n";
}
return $output;
}
Related
Uses
| Uses | Description |
|---|---|
| esc_url() wp-includes/formatting.php | Checks and cleans a URL. |
Changelog
| Version | Description |
|---|---|
| 5.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_sitemaps/add_robots