WordPress.org

Make WordPress Core

Ticket #20633: 20633.patch

File 20633.patch, 716 bytes (added by kitchin, 5 years ago)
  • wp-includes/comment.php

     
    786786        if ( null === $comments && null === $per_page && null === $threaded && !empty($wp_query->max_num_comment_pages) )
    787787                return $wp_query->max_num_comment_pages;
    788788
    789         if ( !$comments || !is_array($comments) )
     789        if ( empty($comments) || !is_array($comments) ) {
     790                if (empty( $wp_query->comments ) )
     791                        return 0;
    790792                $comments = $wp_query->comments;
     793        }
    791794
    792         if ( empty($comments) )
    793                 return 0;
    794 
    795795        if ( !isset($per_page) )
    796796                $per_page = (int) get_query_var('comments_per_page');
    797797        if ( 0 === $per_page )