wp_update_term_count_now default behavior doesn't work
|Reported by:||filosofo||Owned by:||anonymous|
|Severity:||normal||Keywords:||wp_update_term_count_now term taxonomy|
wp_update_term_count_now takes as its first argument an array of term ids, and the terms' taxonomy as its second. Then it updates the terms' counts based on the number of times a term in that taxonomy has a relationship with an object.
If there is a update_search_term_count callback defined for that taxonomy, then wp_update_term_count_now calls the callback to do the term counting. Categories and tags do have their own update_search_term_count callback defined, so normally there is no problem.
However, for any taxonomy that does not have the callback defined, wp_update_term_count_now by default updates the count on its own. And that's where the problem is, because it suddenly treats term_ids as though they were term_taxonomy_ids, which doesn't work.
My patch fixes the problem by retrieving a term's term_taxonomy_id and updating the term count properly.