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

WordPress Trac wp-trac at lists.automattic.com
Mon Oct 10 20:30:10 UTC 2011


#17548: wp_trash_post() does not call update_post_count()
--------------------------------------------------+-----------------------
 Reporter:  joehoyle                              |       Owner:  ryan
     Type:  defect (bug)                          |      Status:  reopened
 Priority:  normal                                |   Milestone:  3.3
Component:  Taxonomy                              |     Version:  3.2
 Severity:  normal                                |  Resolution:
 Keywords:  has-patch dev-feedback needs-testing  |
--------------------------------------------------+-----------------------

Comment (by joehoyle):

 Alternative query with JOIN:


 `SELECT COUNT(*) FROM wp_term_relationships, wp_posts p1 INNER JOIN
 wp_posts p2 ON p1.post_parent = p2.ID WHERE p1.ID =
 wp_term_relationships.object_id AND ( p1.post_status = 'publish' OR (
 p1.post_status = 'inherit' AND p1.post_parent > 0 AND p2.post_status =
 'publish' ) ) AND p1.post_type IN ('attachment') AND term_taxonomy_id =
 11;`

 EXPLAIN:


 {{{
 1       SIMPLE  wp_term_relationships   ref     PRIMARY,term_taxonomy_id
 term_taxonomy_id        8       const   1
 1       SIMPLE  p1      eq_ref  PRIMARY,type_status_date,post_parent
 PRIMARY 8       wordpress-trunk.wp_term_relationships.object_id 1
 Using where
 1       SIMPLE  p2      eq_ref  PRIMARY PRIMARY 8       wordpress-
 trunk.p1.post_parent  1       Using where
 }}}

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


More information about the wp-trac mailing list