WP_Sitemaps_Provider
- Since
- 5.5.0
- Source
wp-includes/sitemaps/class-wp-sitemaps-provider.php:17
Class WP_Sitemaps_Provider.
Hooks fired · 1
Every hook that fires from inside WP_Sitemaps_Provider, in the order it appears in the class, grouped by the method that fires it.
Properties · 2
$namestringprotected- Provider name.
$object_typestringprotected- Object type name (e.g. 'post', 'term', 'user').
Methods · 6
- get_url_list()Gets a URL list for a sitemap.
- get_max_num_pages()Gets the max number of pages available for the object type.
- get_sitemap_type_data()Gets data about each sitemap type.
- get_sitemap_entries()Lists sitemap pages exposed by this provider.
- get_sitemap_url()Gets the URL of a sitemap entry.
- get_object_subtypes()Returns the list of supported object subtypes exposed by the provider.
Source
#[AllowDynamicProperties]abstract class WP_Sitemaps_Provider { /** * Provider name. * * This will also be used as the public-facing name in URLs. * * @since 5.5.0 * * @var string */ protected $name = ''; /** * Object type name (e.g. 'post', 'term', 'user'). * * @since 5.5.0 * * @var string */ protected $object_type = ''; /** * Gets a URL list for a sitemap. * * @since 5.5.0 * * @param int $page_num Page of results. * @param string $object_subtype Optional. Object subtype name. Default empty. * @return array[] Array of URL information for a sitemap. */ abstract public function get_url_list( $page_num, $object_subtype = '' ); /** * Gets the max number of pages available for the object type. * * @since 5.5.0 * * @param string $object_subtype Optional. Object subtype. Default empty. * @return int Total number of pages. */ abstract public function get_max_num_pages( $object_subtype = '' ); /** * Gets data about each sitemap type. * * @since 5.5.0 * * @return array[] Array of sitemap types including object subtype name and number of pages. */ public function get_sitemap_type_data() { $sitemap_data = array(); $object_subtypes = $this->get_object_subtypes(); /* * If there are no object subtypes, include a single sitemap for the * entire object type. */ if ( empty( $object_subtypes ) ) { $sitemap_data[] = array( 'name' => '', 'pages' => $this->get_max_num_pages(), ); return $sitemap_data; } // Otherwise, include individual sitemaps for every object subtype. foreach ( $object_subtypes as $object_subtype_name => $data ) { $object_subtype_name = (string) $object_subtype_name; $sitemap_data[] = array( 'name' => $object_subtype_name, 'pages' => $this->get_max_num_pages( $object_subtype_name ), ); } return $sitemap_data; }History
Introduced in 5.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/sitemaps/class-wp-sitemaps-provider.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.