From ad211ca06abaf65ebf6686afc1207348bb927a3c Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 29 Jan 2014 05:17:12 +0000 Subject: [PATCH] Add Unit Tests for `get_comment_pages_count()`. Fix a notice caused when `$wp_query->comments` is not set in that function. Props mdbitz, markjaquith. Fixes #20633. Built from https://develop.svn.wordpress.org/trunk@27055 git-svn-id: http://core.svn.wordpress.org/trunk@26928 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index c482318c67..cd9c9e9b3e 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -909,7 +909,7 @@ function get_comment_pages_count( $comments = null, $per_page = null, $threaded if ( null === $comments && null === $per_page && null === $threaded && !empty($wp_query->max_num_comment_pages) ) return $wp_query->max_num_comment_pages; - if ( !$comments || !is_array($comments) ) + if ( ( ! $comments || ! is_array( $comments ) ) && ! empty( $wp_query->comments ) ) $comments = $wp_query->comments; if ( empty($comments) )