clean_comment_cache() does not clean $GLOBALS['comment']
|Reported by:||sirzooro||Owned by:|
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.