update_post_term_count_statuses
Filter HookDescription
Filters the post statuses for updating the term count.Hook Information
File Location |
wp-includes/taxonomy.php
View on GitHub
|
Hook Type | Filter |
Line Number | 4170 |
Hook Parameters
Type | Name | Description |
---|---|---|
string[]
|
$post_statuses
|
List of post statuses to include in the count. Default is 'publish'. |
WP_Taxonomy
|
$taxonomy
|
Current taxonomy object. |
Usage Examples
Basic Usage
<?php
// Hook into update_post_term_count_statuses
add_filter('update_post_term_count_statuses', 'my_custom_filter', 10, 2);
function my_custom_filter($post_statuses, $taxonomy) {
// Your custom filtering logic here
return $post_statuses;
}
Source Code Context
wp-includes/taxonomy.php:4170
- How this hook is used in WordPress core
<?php
4165 * @since 5.7.0
4166 *
4167 * @param string[] $post_statuses List of post statuses to include in the count. Default is 'publish'.
4168 * @param WP_Taxonomy $taxonomy Current taxonomy object.
4169 */
4170 $post_statuses = esc_sql( apply_filters( 'update_post_term_count_statuses', $post_statuses, $taxonomy ) );
4171
4172 foreach ( (array) $terms as $term ) {
4173 $count = 0;
4174
4175 // Attachments can be 'inherit' status, we need to base count off the parent's status if so.
PHP Documentation
<?php
/**
* Filters the post statuses for updating the term count.
*
* @since 5.7.0
*
* @param string[] $post_statuses List of post statuses to include in the count. Default is 'publish'.
* @param WP_Taxonomy $taxonomy Current taxonomy object.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/taxonomy.php
Related Hooks
Related hooks will be displayed here in future updates.