Filter hook 'wp_sitemaps_taxonomies_pre_max_num_pages'

in WP Core File wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php at line 166

View Source

wp_sitemaps_taxonomies_pre_max_num_pages

Filter Hook
Description
Filters the max number of pages for a taxonomy sitemap before it is generated. Passing a non-null value will short-circuit the generation, returning that value instead.

Hook Information

File Location wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php View on GitHub
Hook Type Filter
Line Number 166

Hook Parameters

Type Name Description
int|null $max_num_pages The maximum number of pages. Default null.
string $taxonomy Taxonomy name.

Usage Examples

Basic Usage
<?php
// Hook into wp_sitemaps_taxonomies_pre_max_num_pages
add_filter('wp_sitemaps_taxonomies_pre_max_num_pages', 'my_custom_filter', 10, 2);

function my_custom_filter($max_num_pages, $taxonomy) {
    // Your custom filtering logic here
    return $max_num_pages;
}

Source Code Context

wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php:166 - How this hook is used in WordPress core
<?php
 161  		 * @since 5.5.0
 162  		 *
 163  		 * @param int|null $max_num_pages The maximum number of pages. Default null.
 164  		 * @param string   $taxonomy      Taxonomy name.
 165  		 */
 166  		$max_num_pages = apply_filters( 'wp_sitemaps_taxonomies_pre_max_num_pages', null, $taxonomy );
 167  
 168  		if ( null !== $max_num_pages ) {
 169  			return $max_num_pages;
 170  		}
 171  

PHP Documentation

<?php
/**
		 * Filters the max number of pages for a taxonomy sitemap before it is generated.
		 *
		 * Passing a non-null value will short-circuit the generation,
		 * returning that value instead.
		 *
		 * @since 5.5.0
		 *
		 * @param int|null $max_num_pages The maximum number of pages. Default null.
		 * @param string   $taxonomy      Taxonomy name.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php
Related Hooks

Related hooks will be displayed here in future updates.