[wp-trac] [WordPress Trac] #10219: "Older Entries" and "Newer Entries" links are wrong when entries displayed in ascending order
WordPress Trac
noreply at wordpress.org
Wed Oct 29 05:26:25 UTC 2025
#10219: "Older Entries" and "Newer Entries" links are wrong when entries displayed
in ascending order
-------------------------------------+-------------------------------------
Reporter: jikamens | Owner: joedolson
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 6.9
Component: Bundled Theme | Version: 3.2
Severity: normal | Resolution:
Keywords: has-test-info has-patch | Focuses: ui, accessibility,
commit | template
-------------------------------------+-------------------------------------
Comment (by sabernhardt):
I'm done editing the PR for Twenty Ten. Now it does not have
`wp_kses_post()` in either section, and it sets the `$is_desc` variable in
one line (without setting an `$order` variable).
----------
I also checked each PR with the `pre_get_posts` filter and no query string
in the URL:
`http://localhost/svn/src/tag/alice/page/2/`
{{{
function sort_posts_by_date_ascending( $query ) {
if ( $query->is_main_query() && ! is_admin() && $query->is_tag() ) {
$query->set( 'orderby', 'date' );
$query->set( 'order', 'ASC' );
}
}
add_action( 'pre_get_posts', 'sort_posts_by_date_ascending' );
}}}
That sets the posts in ascending order, and the labels match the correct
direction.
Twenty Twenty example:
{{{
<nav class="navigation pagination" aria-label="Posts pagination">
<h2 class="screen-reader-text">Posts pagination</h2>
<div class="nav-links"><a class="prev page-numbers"
href="http://localhost/svn/src/tag/alice/"><span aria-
hidden="true">←</span> <span class="nav-prev-text">Older <span class
="nav-short">Posts</span></span></a>
<a class="page-numbers" href="http://localhost/svn/src/tag/alice/">1</a>
<span aria-current="page" class="page-numbers current">2</span>
<a class="page-numbers"
href="http://localhost/svn/src/tag/alice/page/3/">3</a>
<a class="page-numbers"
href="http://localhost/svn/src/tag/alice/page/4/">4</a>
<a class="next page-numbers"
href="http://localhost/svn/src/tag/alice/page/3/"><span class="nav-next-
text">Newer <span class="nav-short">Posts</span></span> <span aria-
hidden="true">→</span></a></div>
</nav>
}}}
(And it honors the filter's `ASC` sorting even if the URL has a
`?order=DESC` query string.)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/10219#comment:51>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list