[wp-trac] [WordPress Trac] #2877: A Slash too much @ get_pagenum_link()

WordPress Trac noreply at wordpress.org
Mon Aug 21 15:22:54 UTC 2023


#2877: A Slash too much @ get_pagenum_link()
-------------------------------------------------+-------------------------
 Reporter:  dave@…                               |       Owner:  petitphp
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.4
Component:  Posts, Post Types                    |     Version:  2.0
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing has-unit-    |     Focuses:  template
  tests has-testing-info                         |
-------------------------------------------------+-------------------------

Comment (by petitphp):

 Hey @webtechpooja
 >I tried to reproduced the issue as described in the ticket. But couldn't
 make it.
 >The above mentioned links worked for me without using patch, so not sure
 about this patch.
 Sorry, my first report wasn't clear on what and how to test this.

 The original issue is that the `get_pagenum_link` function always add a
 slash at the end of the link to the first page of a post type or taxonomy
 archive even if the permalink structure doesn't contain one.

 >Could you please guide me the steps to reproduce this issue. Thanks
 Here the steps to reproduce the issue and the expected result.

 Given a WordPress install with TwentyTwentyThree theme :
 * Set the permalink structure to `/%postname%` (no trailing slash)
 * Create multiple posts (enough to have at least two pages)
 * On the frontend go to the year archive page (`https://example.com/2023`)
 * The `Older Posts ->` link should be `https://example.com/2023/page/2`
 (no trailing slash, work as expected)
 * Go to the second page (`https://example.com/2023/page/2`)
 * The `<- Newer Posts` link should be `https://example.com/2023` but the
 actual link is `https://example.com/2023/` with a trailing slash (not
 working as expected).

 The patch should fix the issue from the last step and remove the trailing
 slash of the first page link.

 Let me know if you need additional information.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/2877#comment:27>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list