wp_sitemaps_posts_pre_max_num_pages
Filter HookDescription
Filters the max number of pages 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-posts.php
View on GitHub
|
Hook Type | Filter |
Line Number | 200 |
Hook Parameters
Type | Name | Description |
---|---|---|
int|null
|
$max_num_pages
|
The maximum number of pages. Default null. |
string
|
$post_type
|
Post type name. |
Usage Examples
Basic Usage
<?php
// Hook into wp_sitemaps_posts_pre_max_num_pages
add_filter('wp_sitemaps_posts_pre_max_num_pages', 'my_custom_filter', 10, 2);
function my_custom_filter($max_num_pages, $post_type) {
// Your custom filtering logic here
return $max_num_pages;
}
Source Code Context
wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php:200
- How this hook is used in WordPress core
<?php
195 * @since 5.5.0
196 *
197 * @param int|null $max_num_pages The maximum number of pages. Default null.
198 * @param string $post_type Post type name.
199 */
200 $max_num_pages = apply_filters( 'wp_sitemaps_posts_pre_max_num_pages', null, $post_type );
201
202 if ( null !== $max_num_pages ) {
203 return $max_num_pages;
204 }
205
PHP Documentation
<?php
/**
* Filters the max number of pages 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 $post_type Post type name.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php
Related Hooks
Related hooks will be displayed here in future updates.