update_post_term_count_statuses

update_post_term_count_statuses

Hook Type: filter

See hook in core

Displaying hooks found in version: wordpress-6.9

apply_filters('update_post_term_count_statuses') is found 2 times:

  • /wp-includes/post.php line 8231
     
    	// Update counts for the post's terms.
    	foreach ( (array) get_object_taxonomies( $post->post_type, 'objects' ) as $taxonomy ) {
    		/** This filter is documented in wp-includes/taxonomy.php */
    		$counted_statuses = apply_filters( 'update_post_term_count_statuses', array( 'publish' ), $taxonomy );
    
    		/*
    		 * Do not recalculate term count if both the old and new status are not included in term counts.
    		 * This accounts for a transition such as draft -> pending.
    		 */
    		if ( ! in_array( $old_status, $counted_statuses, true ) && ! in_array( $new_status, $counted_statuses, true ) ) {
    
  • /wp-includes/taxonomy.php line 4178
    	 *
    	 * @param string[]    $post_statuses List of post statuses to include in the count. Default is 'publish'.
    	 * @param WP_Taxonomy $taxonomy      Current taxonomy object.
    	 */
    	$post_statuses = esc_sql( apply_filters( 'update_post_term_count_statuses', $post_statuses, $taxonomy ) );
    
    	foreach ( (array) $terms as $tt_id ) {
    		$count = 0;
    
    		// Attachments can be 'inherit' status, we need to base count off the parent's status if so.
    		if ( $check_attachments ) {