Make WordPress Core

Ticket #44179: 44179.diff

File 44179.diff, 1.3 KB (added by allendav, 5 years ago)
  • src/wp-includes/comment.php

     
    34443444        $messages    = array();
    34453445
    34463446        foreach ( (array) $comments as $comment ) {
     3447                $comment_id = (int) $comment->comment_ID;
     3448
    34473449                $anonymized_comment                         = array();
     3450                $anonymized_comment['comment_ID']           = $comment_id;
    34483451                $anonymized_comment['comment_agent']        = '';
    34493452                $anonymized_comment['comment_author']       = $anon_author;
    34503453                $anonymized_comment['comment_author_email'] = wp_privacy_anonymize_data( 'email', $comment->comment_author_email );
     
    34523455                $anonymized_comment['comment_author_url']   = wp_privacy_anonymize_data( 'url', $comment->comment_author_url );
    34533456                $anonymized_comment['user_id']              = 0;
    34543457
    3455                 $comment_id = (int) $comment->comment_ID;
    3456 
    34573458                /**
    34583459                 * Filters whether to anonymize the comment.
    34593460                 *
     
    34793480                        continue;
    34803481                }
    34813482
    3482                 $args = array(
    3483                         'comment_ID' => $comment_id,
    3484                 );
     3483                $updated = wp_update_comment( $anonymized_comment );
    34853484
    3486                 $updated = $wpdb->update( $wpdb->comments, $anonymized_comment, $args );
    3487 
    3488                 if ( $updated ) {
     3485                if ( 1 === $updated ) {
    34893486                        $items_removed = true;
    34903487                        clean_comment_cache( $comment_id );
    34913488                } else {