Is it possible to override default update_count_callback for category? The default function counts published posts while I want to count private posts. I do not want to register a new taxonomy.

1 Answer 1


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.


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' );
  • Thanks, but thats for custom taxonomy. I want to override categorys callback. I mentioned this in the question.
    – a_fan
    Commented May 3, 2012 at 6:32
  • 1
    @afnrf Category is a taxonomy. And you'll notice that he targets 'category' in his answer Commented May 3, 2012 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.