X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/38ac4bc40322ecdc4052db4263466573e01fa51f..6359b807ff8b4ffa151d8756cdefb861c6c1d4db:/wp-includes/post.php diff --git a/wp-includes/post.php b/wp-includes/post.php index d0ecd2e0..d048cff6 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2905,10 +2905,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) );