From e8797fc7d07a6bc626cdf3dfcb6b5b17d3ceed22 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Tue, 4 Aug 2015 04:59:53 +0000 Subject: [PATCH] Comments: IDs are integers. Merge of [33555] to the 4.0 branch. Built from https://develop.svn.wordpress.org/branches/4.0@33558 git-svn-id: http://core.svn.wordpress.org/branches/4.0@33525 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index 94ec8f2c50..a7ff917706 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2888,10 +2888,11 @@ function wp_untrash_post_comments( $post = null ) { foreach ( $group_by_status as $status => $comments ) { // Sanity check. This shouldn't happen. - if ( 'post-trashed' == $status ) + if ( 'post-trashed' == $status ) { $status = '0'; - $comments_in = implode( "', '", $comments ); - $wpdb->query( "UPDATE $wpdb->comments SET comment_approved = '$status' WHERE comment_ID IN ('" . $comments_in . "')" ); + } + $comments_in = implode( ', ', array_map( 'intval', $comments ) ); + $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->comments SET comment_approved = %s WHERE comment_ID IN ($comments_in)", $status ) ); } clean_comment_cache( array_keys($statuses) );