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

WordPress Trac noreply at wordpress.org
Fri Jan 15 03:40:10 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):

 OK, I've had a chance to reproduce.

 My `is_singular()` guess was only half right. When working on #8071, I
 made some assumptions about where and how `comments_template()` is called
 that obviously were not correct - namely, that it's only used in the
 context of single posts. That's why the `is_singular()` check was there.
 And it's why the query added in [36157] used `get_queried_object_id()`.

 So the solution is to use `get_the_ID()` instead, which will always be
 sensitive to the current `$wp_query` loop - whether on a singular
 page/post or not - and, perhaps more importantly, which more closely
 mirrors the query in `comments_template()` (which uses the `$post` global
 to get the 'post_id' for the comment query).

 Ninos Ego - Could you please try [attachment:35402.diff] to see if it's
 doing the trick for you?

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


More information about the wp-trac mailing list