WP_Sitemaps_Users::get_max_num_pages( string $object_subtype = '' )

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


Description Description

See also See also


Top ↑

Parameters Parameters

$object_subtype

(string) (Optional) Not applicable for Users but required for compatibility with the parent provider class.

Default value: ''


Top ↑

Return Return

(int) Total page count.


Top ↑

Source Source

File: wp-includes/sitemaps/providers/class-wp-sitemaps-users.php

	public function get_max_num_pages( $object_subtype = '' ) {
		/**
		 * Filters the max number of pages before it is generated.
		 *
		 * Passing a non-null value will effectively short-circuit the generation,
		 * returning that value instead.
		 *
		 * @since 5.5.0
		 *
		 * @param int $max_num_pages The maximum number of pages. Default null.
		 */
		$max_num_pages = apply_filters( 'wp_sitemaps_users_pre_max_num_pages', null );

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

		$args  = $this->get_users_query_args();
		$query = new WP_User_Query( $args );

		$total_users = $query->get_total();

		return (int) ceil( $total_users / wp_sitemaps_get_max_urls( $this->object_type ) );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.