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
This commit is contained in:
Sergey Biryukov 2019-07-03 01:13:21 +00:00
parent 4503f93961
commit b2ad702410

View File

@ -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