[wp-trac] [WordPress Trac] #35402: per_page parameter no longer works in wp_list_comments

WordPress Trac noreply at wordpress.org
Wed Jan 13 17:04:37 UTC 2016


#35402: per_page parameter no longer works in wp_list_comments
--------------------------+-----------------------
 Reporter:  Ninos Ego     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.4.2
Component:  Comments      |     Version:  4.4.1
 Severity:  major         |  Resolution:
 Keywords:                |     Focuses:  template
--------------------------+-----------------------

Comment (by boonebgorges):

 Ninos Ego - I'm having a hard time reproducing what you've described:

 {{{
 $posts = array( 1, 2, 3 ); // post IDs with comments
 $q = new WP_Query( array(
     'post__in' => $posts,
 ) );

 while ( $q->have_posts() ) {
     $q->the_post();

     wp_list_comments( array(
         'page' => 2,
         'per_page' => 5,
     ) );
 }
 }}}

 `wp_list_comments()` does nothing here, either in 4.3 or 4.4. This is
 because `$wp_query->comments` is empty, and you're not passing a
 `$comments` array to `wp_list_comments()`. The only way I can imagine
 making this work is by calling `comments_template()` within the loop. Is
 that what you're doing? Any more info you can provide on how to reproduce
 would be great.

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


More information about the wp-trac mailing list