WP_Sitemaps_Taxonomies
- Since
- 5.5.0
- Source
wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php:17
Taxonomies XML sitemap provider.
Hooks fired · 5
Every hook that fires from inside WP_Sitemaps_Taxonomies, in the order it appears in the class, grouped by the method that fires it.
WP_Sitemaps_Taxonomies::get_url_list()
- apply_filters( wp_sitemaps_taxonomies_pre_url_list )filter line 84
- apply_filters( wp_sitemaps_taxonomies_entry )filter line 129
Methods · 5
- __construct()WP_Sitemaps_Taxonomies constructor.
- get_object_subtypes()Returns all public, registered taxonomies.
- get_url_list()Gets a URL list for a taxonomy sitemap.
- get_max_num_pages()Gets the max number of pages available for the object type.
- get_taxonomies_query_args()Returns the query args for retrieving taxonomy terms to list in the sitemap.
Source
class WP_Sitemaps_Taxonomies extends WP_Sitemaps_Provider { /** * WP_Sitemaps_Taxonomies constructor. * * @since 5.5.0 */ public function __construct() { $this->name = 'taxonomies'; $this->object_type = 'term'; } /** * Returns all public, registered taxonomies. * * @since 5.5.0 * * @return WP_Taxonomy[] Array of registered taxonomy objects keyed by their name. */ public function get_object_subtypes() { $taxonomies = get_taxonomies( array( 'public' => true ), 'objects' ); $taxonomies = array_filter( $taxonomies, 'is_taxonomy_viewable' ); /** * Filters the list of taxonomy object subtypes available within the sitemap. * * @since 5.5.0 * * @param WP_Taxonomy[] $taxonomies Array of registered taxonomy objects keyed by their name. */ return apply_filters( 'wp_sitemaps_taxonomies', $taxonomies ); } /** * Gets a URL list for a taxonomy sitemap. * * @since 5.5.0 * @since 5.9.0 Renamed `$taxonomy` to `$object_subtype` to match parent class * for PHP 8 named parameter support. * * @param int $page_num Page of results. * @param string $object_subtype Optional. Taxonomy name. Default empty. * @return array[] Array of URL information for a sitemap. */ public function get_url_list( $page_num, $object_subtype = '' ) { // Restores the more descriptive, specific name for use within this method. $taxonomy = $object_subtype; $supported_types = $this->get_object_subtypes(); // Bail early if the queried taxonomy is not supported. if ( ! isset( $supported_types[ $taxonomy ] ) ) { return array(); } /** * Filters the taxonomies URL list before it is generated. * * Returning a non-null value will effectively short-circuit the generation, * returning that value instead. * * @since 5.5.0 * * @param array[]|null $url_list The URL list. Default null. * @param string $taxonomy Taxonomy name. * @param int $page_num Page of results. */ $url_list = apply_filters( 'wp_sitemaps_taxonomies_pre_url_list', null, $taxonomy, $page_num ); if ( null !== $url_list ) { return $url_list; } $url_list = array();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 6.7.7 tag, from
src/wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.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.