From b2ad702410ccad6afe6c2aae8c7f75ed477c5025 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 3 Jul 2019 01:13:21 +0000 Subject: [PATCH] Query: Make sure `$climits` variable in `WP_Query::get_posts()` is always defined to avoid a PHP notice. Props juiiee8487, agengineering. Fixes #47638. git-svn-id: https://develop.svn.wordpress.org/trunk@45591 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-query.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php index 662a5b108b..3d7374cf93 100644 --- a/src/wp-includes/class-wp-query.php +++ b/src/wp-includes/class-wp-query.php @@ -2629,8 +2629,10 @@ class WP_Query { */ $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option( 'posts_per_rss' ), &$this ) ); } + $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : ''; $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : ''; + $climits = ( ! empty( $climits ) ) ? $climits : ''; $comments = (array) $wpdb->get_results( "SELECT $distinct {$wpdb->comments}.* FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits" ); // Convert to WP_Comment