[wp-trac] [WordPress Trac] #11073: Comment Status for Posts in the Trash

WordPress Trac wp-trac at lists.automattic.com
Thu Nov 5 17:23:15 UTC 2009

#11073: Comment Status for Posts in the Trash
 Reporter:  mtdewvirus    |       Owner:                
     Type:  defect (bug)  |      Status:  new           
 Priority:  normal        |   Milestone:  2.9           
Component:  Comments      |     Version:  2.9           
 Severity:  normal        |    Keywords:  comments,trash

Comment(by ryan):

 Patch introduce wp_trash_post_comments() and wp_untrash_post_comments().
 Comments for trashed posts have their status (comment_approved) set to
 post-trashed.  Changing the status allows us to avoid slow joins with the
 posts table while keeping correct comment counts.  A status of "post-
 trashed" is used instead of "trash" so that comments belonging to a
 trashed post don't show up in the comment trash. They cannot be restored
 if their post is trashed so showing them is confusing.  The queries in
 edit-comments.php still use the join on the posts table.  I left it there
 for the moment so that comments whose post was trashed prior to this patch
 don't show up.

 Status for each comment is preserved in an array in postmeta.  Status is
 restored when the post is untrashed. If a comment was in the trash before
 the post was trashed, it will remain in the trash with its previous state
 still stored in commentmeta.

Ticket URL: <http://core.trac.wordpress.org/ticket/11073#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list