WP_Sitemaps::sitemaps_enabled() public WP 5.5.0
Determines whether sitemaps are enabled or not.
{} It's a method of the class: WP_Sitemaps{}
Hooks from the method
Return
true/false. Whether sitemaps are enabled.
Usage
$WP_Sitemaps = new WP_Sitemaps(); $WP_Sitemaps->sitemaps_enabled();
Changelog
Since 5.5.0 | Introduced. |
Code of WP_Sitemaps::sitemaps_enabled() WP Sitemaps::sitemaps enabled WP 5.6
public function sitemaps_enabled() {
$is_enabled = (bool) get_option( 'blog_public' );
/**
* Filters whether XML Sitemaps are enabled or not.
*
* When XML Sitemaps are disabled via this filter, rewrite rules are still
* in place to ensure a 404 is returned.
*
* @see WP_Sitemaps::register_rewrites()
*
* @since 5.5.0
*
* @param bool $is_enabled Whether XML Sitemaps are enabled or not. Defaults
* to true for public sites.
*/
return (bool) apply_filters( 'wp_sitemaps_enabled', $is_enabled );
}