[wp-trac] [WordPress Trac] #51537: Changes made to comments_array hook do not take effect if 'per_page' parameter is set in wp_list_comments()

WordPress Trac noreply at wordpress.org
Thu Oct 15 15:31:31 UTC 2020


#51537: Changes made to comments_array hook do not take effect if 'per_page'
parameter is set in wp_list_comments()
--------------------------+-----------------------------
 Reporter:  mic22         |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Comments      |    Version:  5.5.1
 Severity:  normal        |   Keywords:  needs-testing
  Focuses:  template      |
--------------------------+-----------------------------
 If in the comments.php template file we use wp_list_comments() with a
 parameter 'per_page', any changes made to comments_array Hook are omitted
 or reset.

 Steps to reproduce:
 1. Set the 'per_page' argument like this: wp_list_comments( [ 'per_page'
 => '20' ] );
 2. Add this line to functions.php: add_filter( 'comments_array',
 'array_reverse' );

 The line in functions.php will not take effect. But if you remove the
 'per_page' parameter, everything works and the comment order is reversed.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51537>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list