WP_Sitemaps_Taxonomies::get_max_num_pages()
Gets the max number of pages available for the object type.
Метод класса: WP_Sitemaps_Taxonomies{}
Хуки из метода
Возвращает
int
. Total number of pages.
Использование
$WP_Sitemaps_Taxonomies = new WP_Sitemaps_Taxonomies(); $WP_Sitemaps_Taxonomies->get_max_num_pages( $object_subtype );
- $object_subtype(строка)
- Taxonomy name.
По умолчанию: ''
Список изменений
С версии 5.5.0 | Введена. |
С версии 5.9.0 | Renamed $taxonomy to $object_subtype to match parent class for PHP 8 named parameter support. |
Код WP_Sitemaps_Taxonomies::get_max_num_pages() WP Sitemaps Taxonomies::get max num pages WP 6.7.1
public function get_max_num_pages( $object_subtype = '' ) { if ( empty( $object_subtype ) ) { return 0; } // Restores the more descriptive, specific name for use within this method. $taxonomy = $object_subtype; /** * Filters the max number of pages for a taxonomy sitemap 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 $taxonomy Taxonomy name. */ $max_num_pages = apply_filters( 'wp_sitemaps_taxonomies_pre_max_num_pages', null, $taxonomy ); if ( null !== $max_num_pages ) { return $max_num_pages; } $term_count = wp_count_terms( $this->get_taxonomies_query_args( $taxonomy ) ); return (int) ceil( $term_count / wp_sitemaps_get_max_urls( $this->object_type ) ); }