[wp-trac] [WordPress Trac] #34771: Comment ordering is not applying the order by latest or newest filter.

WordPress Trac noreply at wordpress.org
Tue Nov 24 13:33:14 UTC 2015


#34771: Comment ordering is not applying the order by latest or newest filter.
-------------------------------+----------------------
 Reporter:  alexvandervegt     |       Owner:
     Type:  defect (bug)       |      Status:  closed
 Priority:  normal             |   Milestone:
Component:  Comments           |     Version:  4.3.1
 Severity:  normal             |  Resolution:  wontfix
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+----------------------
Changes (by boonebgorges):

 * status:  new => closed
 * resolution:   => wontfix
 * milestone:  Awaiting Review =>


Comment:

 Thanks for the clarification, @alexvandervegt. I'd say that looping over
 `$comments` is a technique that we can't officially support in all cases.
 WP can't enforce things like threading and pagination if you don't use a
 `Walker`-like tool for building markup.

 However! This has all been rewritten for 4.4. The comment query in
 `comments_template()` still grabs comments with `orderby =>
 'comment_date_gmt'` and `order => 'ASC'`, but it does most of the
 pagination work before hitting the `Walker` in `wp_list_comments()`. See
 #5809.

 I'd suggest that, if you plan to loop over `$comments` in comments.php,
 you do some preprocessing of those comments to ensure the proper order,
 threading, etc. The `comments_array` filter will work well for this.
 However, if you have a good reason for preferring to do it with a filter,
 you may want to try a `pre_get_comments` callback.

 Thanks for the ticket!

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


More information about the wp-trac mailing list