WP_Sitemaps::register_sitemaps() WordPress Method

The WP_Sitemaps::register_sitemaps() method is used to register sitemaps with the WordPress sitemaps API. This method should be called from the 'init' action hook. The first parameter is an array of sitemap types. The array keys are the sitemap type names, and the array values are the class names of the sitemap classes. The second parameter is an array of sitemap arguments. The array keys are the sitemap type names, and the array values are the arrays of sitemap arguments. The third parameter is an array of callback functions. The array keys are the sitemap type names, and the array values are the name of the callback functions. The fourth parameter is an array of class instances. The array keys are the sitemap type names, and the array values are the class instances.

WP_Sitemaps::register_sitemaps() #

Registers and sets up the functionality for all supported sitemaps.


Source

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

	public function register_sitemaps() {
		$providers = array(
			'posts'      => new WP_Sitemaps_Posts(),
			'taxonomies' => new WP_Sitemaps_Taxonomies(),
			'users'      => new WP_Sitemaps_Users(),
		);

		/* @var WP_Sitemaps_Provider $provider */
		foreach ( $providers as $name => $provider ) {
			$this->registry->add_provider( $name, $provider );
		}
	}


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.