[wp-trac] [WordPress Trac] #55751: get_the_posts_navigation() is using incorrect functions to output navigation links

WordPress Trac noreply at wordpress.org
Tue Jun 7 20:02:32 UTC 2022

#55751: get_the_posts_navigation() is using incorrect functions to output
navigation links
 Reporter:  jongycastillo             |       Owner:  (none)
     Type:  defect (bug)              |      Status:  reopened
 Priority:  normal                    |   Milestone:  6.1
Component:  Posts, Post Types         |     Version:  5.9.3
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:

Comment (by jongycastillo):

 Replying to [comment:10 SergeyBiryukov]:
 > Hi there, welcome to WordPress Trac! Thanks for the ticket and the PRs.
 > This is indeed super confusing. It makes some sense in theory, but I'm
 still trying to wrap my head around what would be the expected result for
 the code in comment:7, and I'm not 100% sure yet that there is no core bug
 > Moving to the milestone to add some unit tests and maybe improve
 documenation for these functions and filters.

 The expected result for the code output is:

 <nav class="navigation posts-navigation" aria-label="Posts">
     <h2 class="screen-reader-text">Posts navigation</h2>
     <div class="nav-links">
         <div class="nav-previous"><a
 href="http://website.test/2020/page/3/" data-pagination="prev-
         <div class="nav-next"><a href="http://website.test/2020/" data-

 Even if `the_posts_navigation()` switches the order like in geisthanen's
 explanation, the attributes passed in the filter should stick to their
 anchor elements based on the name of the parameters in the accepted array
 for `get_the_posts_navigation()`. It may help to clarify in the
 documentation that if because of the reverse chronological order,
 developers may prefer to directly use `get_next_posts_link()` and
 `get_previous_posts_link()` instead of `the_posts_navigation()` and

Ticket URL: <https://core.trac.wordpress.org/ticket/55751#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list