[wp-trac] [WordPress Trac] #51305: wp_list_comments returns nothing if "per_page" parameter is defined

WordPress Trac noreply at wordpress.org
Sat Dec 12 17:12:19 UTC 2020


#51305: wp_list_comments returns nothing if "per_page" parameter is defined
------------------------------------------+------------------------------
 Reporter:  SGr33n                        |       Owner:  metalandcoffee
     Type:  defect (bug)                  |      Status:  assigned
 Priority:  normal                        |   Milestone:  Awaiting Review
Component:  Comments                      |     Version:  5.5.1
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+------------------------------

Comment (by SGr33n):

 First test, working:

 {{{#!php
 <?php
         wp_list_comments(
                 array(
                         'page'                  => 1,
                         'per_page'              => 10,
                         'style'                 => 'div',
                 )
         );
 }}}

 Second test (non working):

 {{{#!php
 <?php
         wp_list_comments(
                 array(
                         'page'                  => 1,
                         'per_page'              => absint( get_option(
 'comments_per_page' ) ),
                         'style'                 => 'div',
                 )
         );
 }}}

 Is returning


 {{{
 [12-Dec-2020 17:07:55 UTC] PHP Notice:  Undefined variable: _comments in
 /web/wp-includes/comment-template.php on line 2236
 [12-Dec-2020 17:07:55 UTC] PHP Notice:  Undefined variable: _comments in
 /web/wp-includes/comment-template.php on line 2244
 }}}


 PHP version 7.4
 PHP-FPM
 Webserver Nginx
 WordPress version 5.6

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51305#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list