WP_Sitemaps::sitemaps_enabled() WordPress Method

The WP_Sitemaps::sitemaps_enabled() method enables the sitemap feature for the site. This method is called by the init action.

WP_Sitemaps::sitemaps_enabled() #

Determines whether sitemaps are enabled or not.


Return

(bool) Whether sitemaps are enabled.


Top ↑

Source

File: wp-includes/sitemaps/class-wp-sitemaps.php

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


Top ↑

Changelog

Changelog
VersionDescription
5.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.