#51537 closed defect (bug) (invalid)
Changes made to comments_array hook do not take effect if 'per_page' parameter is set in wp_list_comments()
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Comments | Keywords: | |
Focuses: | template | Cc: |
Description
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:
- Set the 'per_page' argument like this: wp_list_comments( [ 'per_page' => '20' ] );
- 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.
Change History (3)
#2
@
4 years ago
- Keywords needs-testing removed
- Milestone Awaiting Review deleted
- Version 5.5.1 deleted
#3
@
4 years ago
Upon inspecting more code and reading comments in php I came to realize that it's an intended behavior of wordpress. I closed the ticket, because this does not qualify as a bug. Yet I think it could be revisited in the future and the code should be improved to allow better comment handling.
Note: See
TracTickets for help on using
tickets.
Hi @mic22,
Welcome to Trac!
I just wanted to confirm that closing this ticket was intentional. If you were able to fix the problem, do you mind sharing what was causing the issue? It may help others in the future.
Thanks!