WordPress at a glance
function is not described

WP_Sitemaps_Posts::get_max_num_pages() public WP 5.5.0

Gets the max number of pages available for the object type.

{} It's a method of the class: WP_Sitemaps_Posts{}

Hooks from the method
Return

Int. Total number of pages.

Usage

$WP_Sitemaps_Posts = new WP_Sitemaps_Posts();
$WP_Sitemaps_Posts->get_max_num_pages( $post_type );
$post_type(string)
Post type name.
Default: ''

Changelog

Since 5.5.0 Introduced.

Code of WP_Sitemaps_Posts::get_max_num_pages() WP 5.5.1

<?php
public function get_max_num_pages( $post_type = '' ) {
	if ( empty( $post_type ) ) {
		return 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.
	 *
	 * @since 5.5.0
	 *
	 * @param int|null $max_num_pages The maximum number of pages. Default null.
	 * @param string   $post_type     Post type name.
	 */
	$max_num_pages = apply_filters( 'wp_sitemaps_posts_pre_max_num_pages', null, $post_type );

	if ( null !== $max_num_pages ) {
		return $max_num_pages;
	}

	$args                  = $this->get_posts_query_args( $post_type );
	$args['fields']        = 'ids';
	$args['no_found_rows'] = false;

	$query = new WP_Query( $args );

	$min_num_pages = ( 'page' === $post_type && 'posts' === get_option( 'show_on_front' ) ) ? 1 : 0;
	return isset( $query->max_num_pages ) ? max( $min_num_pages, $query->max_num_pages ) : 1;
}