Comments: IDs are integers.

Merge of [33555] to the 4.2 branch.
Built from https://develop.svn.wordpress.org/branches/4.2@33556


git-svn-id: http://core.svn.wordpress.org/branches/4.2@33523 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2015-08-04 04:59:00 +00:00
parent e2e6972945
commit f59f79151e

View 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) );