How to Override default update_count_callback for category

In your update_count_callback function do a check for $post->post_status and don’t increment your count if post_status is not private.

See this excellent answer on writing a custom update_count_callback callback function.

Edit:

Misread the question. To override the existing default for the category taxonomy you can create a function that overrides the global $wp_taxonomies variable

function change_category_arg() {
    global $wp_taxonomies;
    if ( ! taxonomy_exists('category') )
        return false;
            
    $new_arg = &$wp_taxonomies['category']->update_count_callback;
    $new_arg->update_count_callback = 'your_new_arg';
    
}
add_action( 'init', 'change_category_arg' );

Leave a Comment