update_post_term_count_statuses
Filters the post statuses for updating the term count.
Usage
add_filter( 'update_post_term_count_statuses', 'wp_kama_update_post_term_count_statuses_filter', 10, 2 );
/**
* Function for `update_post_term_count_statuses` filter-hook.
*
* @param string[] $post_statuses List of post statuses to include in the count.
* @param WP_Taxonomy $taxonomy Current taxonomy object.
*
* @return string[]
*/
function wp_kama_update_post_term_count_statuses_filter( $post_statuses, $taxonomy ){
// filter...
return $post_statuses;
}
- $post_statuses(string[])
- List of post statuses to include in the count.
Default: 'publish' - $taxonomy(WP_Taxonomy)
- Current taxonomy object.
Changelog
| Since 5.7.0 | Introduced. |
Where the hook is called
update_post_term_count_statuses
wp-includes/taxonomy.php 4182
$post_statuses = esc_sql( apply_filters( 'update_post_term_count_statuses', $post_statuses, $taxonomy ) );
wp-includes/post.php 8230
$counted_statuses = apply_filters( 'update_post_term_count_statuses', array( 'publish' ), $taxonomy );