[wp-trac] [WordPress Trac] #17548: wp_trash_post() does not call update_post_count()
WordPress Trac
wp-trac at lists.automattic.com
Mon Aug 22 17:53:16 UTC 2011
#17548: wp_trash_post() does not call update_post_count()
--------------------------------------------------+------------------
Reporter: joehoyle | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.3
Component: Taxonomy | Version: 3.2
Severity: normal | Resolution:
Keywords: has-patch dev-feedback needs-testing |
--------------------------------------------------+------------------
Comment (by joehoyle):
Added patch with it in a separate function. I should clarify when this is
needed:
When you update / trash a post with a custom taxonomy. As
`wp_set_object_terms` is never called for the custom taxonomy, the term
counts are not updated. Tags / Categories are always keps in sync, as
`wp_insert_post` calls `wp_set_post_categories` and `wp_set_post_tags`. It
only calls `wp_set_post_terms` if you pass an array of terms to be added
to the post (which `wp_trash_post` / removing all terms will not do).
Though the attached patch only covers this scenario, it will mean whenever
a post's status is updated, terms counts will be kept in sync - this isn't
true as things stand at the moment.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/17548#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list