equal
deleted
inserted
replaced
12 /** |
12 /** |
13 * Class WP_Sitemaps. |
13 * Class WP_Sitemaps. |
14 * |
14 * |
15 * @since 5.5.0 |
15 * @since 5.5.0 |
16 */ |
16 */ |
|
17 #[AllowDynamicProperties] |
17 class WP_Sitemaps { |
18 class WP_Sitemaps { |
18 /** |
19 /** |
19 * The main index of supported sitemaps. |
20 * The main index of supported sitemaps. |
20 * |
21 * |
21 * @since 5.5.0 |
22 * @since 5.5.0 |
96 * |
97 * |
97 * @see WP_Sitemaps::register_rewrites() |
98 * @see WP_Sitemaps::register_rewrites() |
98 * |
99 * |
99 * @since 5.5.0 |
100 * @since 5.5.0 |
100 * |
101 * |
101 * @param bool $is_enabled Whether XML Sitemaps are enabled or not. Defaults |
102 * @param bool $is_enabled Whether XML Sitemaps are enabled or not. |
102 * to true for public sites. |
103 * Defaults to true for public sites. |
103 */ |
104 */ |
104 return (bool) apply_filters( 'wp_sitemaps_enabled', $is_enabled ); |
105 return (bool) apply_filters( 'wp_sitemaps_enabled', $is_enabled ); |
105 } |
106 } |
106 |
107 |
107 /** |
108 /** |
247 /** |
248 /** |
248 * Adds the sitemap index to robots.txt. |
249 * Adds the sitemap index to robots.txt. |
249 * |
250 * |
250 * @since 5.5.0 |
251 * @since 5.5.0 |
251 * |
252 * |
252 * @param string $output robots.txt output. |
253 * @param string $output robots.txt output. |
253 * @param bool $public Whether the site is public. |
254 * @param bool $is_public Whether the site is public. |
254 * @return string The robots.txt output. |
255 * @return string The robots.txt output. |
255 */ |
256 */ |
256 public function add_robots( $output, $public ) { |
257 public function add_robots( $output, $is_public ) { |
257 if ( $public ) { |
258 if ( $is_public ) { |
258 $output .= "\nSitemap: " . esc_url( $this->index->get_index_url() ) . "\n"; |
259 $output .= "\nSitemap: " . esc_url( $this->index->get_index_url() ) . "\n"; |
259 } |
260 } |
260 |
261 |
261 return $output; |
262 return $output; |
262 } |
263 } |