$comment_id_list = implode( ',', $comment_ids );
// Update the `comment_type` field value to be `comment` for the next batch of comments.
"UPDATE {$wpdb->comments}
SET comment_type = 'comment'
AND comment_ID IN ({$comment_id_list})" // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
// Make sure to clean the comment cache.
clean_comment_cache( $comment_ids );
delete_option( $lock_name );
* In order to avoid the _wp_batch_update_comment_type() job being accidentally removed,
* check that it's still scheduled while we haven't finished updating comment types.
function _wp_check_for_scheduled_update_comment_type() {
if ( ! get_option( 'finished_updating_comment_type' ) && ! wp_next_scheduled( 'wp_update_comment_type_batch' ) ) {
wp_schedule_single_event( time() + MINUTE_IN_SECONDS, 'wp_update_comment_type_batch' );