[wp-trac] [WordPress Trac] #11566: clean_comment_cache() does not clean $GLOBALS['comment']

WordPress Trac wp-trac at lists.automattic.com
Tue Dec 22 21:18:23 UTC 2009


#11566: clean_comment_cache() does not clean $GLOBALS['comment']
--------------------------+-------------------------------------------------
 Reporter:  sirzooro      |       Owner:           
     Type:  defect (bug)  |      Status:  new      
 Priority:  normal        |   Milestone:  2.9.1    
Component:  Comments      |     Version:  2.9      
 Severity:  normal        |    Keywords:  has-patch
--------------------------+-------------------------------------------------
 I am trying to add links to comment list, which will allow to delete
 comments directly without need to move them to trash first (and with trash
 enabled). For posts/pages I found working workaround: hook `trashed_post`
 and `call wp_delete_post()` again from.

 Unfortunately similar approach for comments does work. As I checked,
 `wp_trash_comment()` calls `get_comment()`. The latter function implements
 simple comments cache using `$GLOBALS['comment']`. When you change comment
 status to `trash`, `wp_set_comment_status()` clears cache by calling
 `clean_comment_cache()`, but it leaves that global set. As a result my
 workaround does not work.

 I think that `clean_comment_cache()` should clear that global too.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11566>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list