]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/post.php
WordPress 4.2.4
[autoinstalls/wordpress.git] / wp-includes / post.php
index d0ecd2e04e7678e4abb6395ed9a63e5b0eac32fb..d048cff69f3a37bb8f4a071b0b421f99dcdc209d 100644 (file)
@@ -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) );