From 9d8768f4427a004cc8064f3332b4323d5b099719 Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Mon, 3 Aug 2015 21:37:26 +0000 Subject: [PATCH] Comments: IDs are integers. git-svn-id: https://develop.svn.wordpress.org/trunk@33555 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/post.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php index ff332e2196..f15c9e23a5 100644 --- a/src/wp-includes/post.php +++ b/src/wp-includes/post.php @@ -2937,10 +2937,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) );