WP_Sitemaps::sitemaps_enabled()publicWP 5.5.0

Determines whether sitemaps are enabled or not.

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.

WP_Sitemaps::sitemaps_enabled() code WP 6.5.2

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 );
}