Comments shouldn't have more than one `_wp_trash_meta_status` entry. When deleting `_wp_trash_meta_status`, also delete `_wp_trash_meta_time`.

See #11200.


git-svn-id: https://develop.svn.wordpress.org/trunk@33654 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-08-20 02:44:39 +00:00
parent 5e9a216cf7
commit cb9f80009f
1 changed files with 10 additions and 4 deletions

View File

@ -1857,8 +1857,10 @@ function wp_trash_comment($comment_id) {
do_action( 'trash_comment', $comment_id );
if ( wp_set_comment_status($comment_id, 'trash') ) {
add_comment_meta($comment_id, '_wp_trash_meta_status', $comment->comment_approved);
add_comment_meta($comment_id, '_wp_trash_meta_time', time() );
delete_comment_meta( $comment_id, '_wp_trash_meta_status' );
delete_comment_meta( $comment_id, '_wp_trash_meta_time' );
add_comment_meta( $comment_id, '_wp_trash_meta_status', $comment->comment_approved );
add_comment_meta( $comment_id, '_wp_trash_meta_time', time() );
/**
* Fires immediately after a comment is sent to Trash.
@ -1938,7 +1940,10 @@ function wp_spam_comment($comment_id) {
do_action( 'spam_comment', $comment_id );
if ( wp_set_comment_status($comment_id, 'spam') ) {
add_comment_meta($comment_id, '_wp_trash_meta_status', $comment->comment_approved);
delete_comment_meta( $comment_id, '_wp_trash_meta_status' );
delete_comment_meta( $comment_id, '_wp_trash_meta_time' );
add_comment_meta( $comment_id, '_wp_trash_meta_status', $comment->comment_approved );
add_comment_meta( $comment_id, '_wp_trash_meta_time', time() );
/**
* Fires immediately after a comment is marked as Spam.
*
@ -1979,7 +1984,8 @@ function wp_unspam_comment($comment_id) {
$status = '0';
if ( wp_set_comment_status($comment_id, $status) ) {
delete_comment_meta($comment_id, '_wp_trash_meta_status');
delete_comment_meta( $comment_id, '_wp_trash_meta_status' );
delete_comment_meta( $comment_id, '_wp_trash_meta_time' );
/**
* Fires immediately after a comment is unmarked as Spam.
*