[wp-trac] [WordPress Trac] #17548: wp_trash_post() does not call update_post_count()

WordPress Trac wp-trac at lists.automattic.com
Mon Aug 29 15:40:30 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):

 I have added a new patch to improve the default `update_count_callback`,
 by doing an INNER JOIN on the posts table to exclude trashed posts.

 The generated query becomes:

 {{{
 SELECT COUNT(*) FROM wp_term_relationships INNER JOIN wp_posts ON
 wp_term_relationships.object_id = wp_posts.ID WHERE
 wp_term_relationships.term_taxonomy_id = 3 AND wp_posts.post_status !=
 'trash'
 }}}

 Again, to reproduce this issue - register a custom taxonomy and trash a
 post with a term assigned from that taxonomy. The count of the term
 taxonomy will not update.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17548#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list