When are tags counted? Can it be trigered manually?

You can call wp_update_term_count_now( $terms, $taxonomy ) (documentation) to update the term count for the specified terms (you will need to pass an array of all terms if you want to update them all).

If you want to use your own function instead of the standard function (which counts all posts), you can set the update_count_callback of the taxonomy. The function you specify here will be used instead.

Remember, the tags are configured like any other (custom) taxonomy, so you can change their parameters too. It is registered in the global $wp_taxonomies array with the post_tag key.

Leave a Comment