wp_sitemaps_posts_pre_max_num_pages хук-фильтрWP 5.5.0

Filters the max number of pages before it is generated.

Passing a non-null value will short-circuit the generation, returning that value instead.

Использование

add_filter( 'wp_sitemaps_posts_pre_max_num_pages', 'wp_kama_sitemaps_posts_pre_max_num_pages_filter', 10, 2 );

/**
 * Function for `wp_sitemaps_posts_pre_max_num_pages` filter-hook.
 * 
 * @param int|null $max_num_pages The maximum number of pages.
 * @param string   $post_type     Post type name.
 *
 * @return int|null
 */
function wp_kama_sitemaps_posts_pre_max_num_pages_filter( $max_num_pages, $post_type ){

	// filter...
	return $max_num_pages;
}
$max_num_pages(int|null)
The maximum number of pages.
По умолчанию: null
$post_type(строка)
Post type name.

Список изменений

С версии 5.5.0 Введена.

Где вызывается хук

WP_Sitemaps_Posts::get_max_num_pages()
wp_sitemaps_posts_pre_max_num_pages
wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php 200
$max_num_pages = apply_filters( 'wp_sitemaps_posts_pre_max_num_pages', null, $post_type );

Где используется хук в WordPress

Использование не найдено.