WP_Sitemaps_Users::get_max_num_pages
Gets the max number of pages available for the object type.
Метод класса: WP_Sitemaps_Users{}
Хуки из метода
Возвращает
int. Total page count.
Использование
$WP_Sitemaps_Users = new WP_Sitemaps_Users(); $WP_Sitemaps_Users->get_max_num_pages( $object_subtype );
- $object_subtype(строка)
- Not applicable for Users but required for compatibility with the parent provider class.
По умолчанию:''
Заметки
| Смотрите: WP_Sitemaps_Provider::max_num_pages |
Список изменений
| С версии 5.5.0 | Введена. |
Код WP_Sitemaps_Users::get_max_num_pages() WP Sitemaps Users::get max num pages WP 7.1.4
public function get_max_num_pages( $object_subtype = '' ) {
/**
* Filters the max number of pages for a user sitemap before it is generated.
*
* Returning a non-null value will effectively 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.
*/
$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 ) );
}