Opened 9 years ago
Last modified 6 years ago
#35805 reviewing defect (bug)
Reverse page order in wp_list_comments() with newest comments first
Reported by: | Ninos Ego | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.4.2 |
Component: | Comments | Keywords: | needs-patch needs-unit-tests |
Focuses: | template | Cc: |
Description
Hey there,
since wp 4.4 there were lots of bugs in the wp_list_comments()-function. Some of them are already fixed, now I found another one.
If you change the comments order from default (oldest first) to newest first, the page order is wrong (reverse page order).
Example
You have 4 pages by sending following param you get these pages:
page=1 -> 4 page=2 -> 3 page=3 -> 2 page=4 -> 1
How I call this function
Inside the post-loop I'm calling:
<?php while ( have_posts() ) : the_post(); get_template_part( 'templates/content', 'comment' );
The template file templates/content-comment.php has following content:
<?php if ( ! defined( 'ABSPATH' ) ) { exit; } ?> <?php global $withcomments; ?> <?php $withcomments = 1; ?> <?php add_filter( 'comments_template', '__return_true' ); ?> <?php if ( comments_open() || get_comments_number() ) : ?> <div class="entry-comment"> <?php comments_template( '/comments-content.php' ); ?> </div> <?php endif; ?>
And comments-content.php has following part:
<?php wp_list_comments( array( 'page' => $cpaged, // Variable defined before, default: 1 'per_page' => 2 ) ); ?>
PS: In ticketing system the version 4.4.2 is not available :-)
Change History (8)
#2
@
9 years ago
- Milestone changed from Awaiting Review to 4.4.3
- Owner set to boonebgorges
- Severity changed from critical to normal
- Status changed from new to reviewing
- Version changed from trunk to 4.4
This ticket was mentioned in Slack in #core by chriscct7. View the logs.
9 years ago
This ticket was mentioned in Slack in #core by chriscct7. View the logs.
9 years ago
#5
follow-up:
↓ 6
@
9 years ago
- Keywords has-patch dev-feedback added
@boonebgorges have you reviewed the patch, or should we punt this a release per discussion in ticket triage?
#6
in reply to:
↑ 5
@
9 years ago
- Keywords needs-patch needs-unit-tests added; has-patch dev-feedback removed
- Milestone changed from 4.4.3 to Future Release
- Version changed from 4.4 to 4.4.2
Replying to chriscct7:
@boonebgorges have you reviewed the patch, or should we punt this a release per discussion in ticket triage?
There's no patch to review. We'll have to punt.
Thanks for the ticket. I'll review.