Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#55993 new defect (bug)

Wrong canonical redirect for paged posts page

Reported by: chouby's profile Chouby Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Canonical Keywords: needs-testing-info
Focuses: Cc:

Description

  • Setup a site with a static front page and a posts page (let's call it "Posts").
  • Take note of the page_id of the posts page. 265 in my case.
  • Make sure to use pretty permalinks.
  • Create sufficient posts to be able to display the page 2 of the posts page.
  • In the address bar, type https://mysite.com/?page_id=265 (the posts page plain permalink) => The site is correctly redirected to https://mysite.com/posts/
  • In the address bar, type https://mysite.com/?paged=2&page_id=265 (the paged posts page plain permalink) => The site is wrongly redirected to https://mysite.com/page/2/ and displays an empty content. I would expect the url to be redirected to https://mysite.com/posts/page/2/

Change History (4)

#1 @SergeyBiryukov
2 years ago

  • Keywords needs-patch needs-unit-tests added

Hi there, thanks for the ticket!

This appears to be related to #28081 and #50163, but also seems like a distinct issue, as the page does actually exist.

#2 @afercia
2 years ago

  • Keywords reporter-feedback added; needs-patch needs-unit-tests removed

Testing on latest trunk, I can't seem to be able to reproduce the issue.

@Chouby can you still reproduce the issue on latest trunk, with all plugins deactivated an one of the bundled themes active?

#3 @Chouby
2 years ago

@afercia Yes I confirm that the bug still exists. I just re-tested with the development version (6.2-alpha-54748) and Twenty Twenty One.

I took the opportunity to debug a bit.
At this line, $addl_path is filled with the pagination base and number. Previously, it's an empty string. Then the redirect path is filled here.

#4 @afercia
2 years ago

  • Keywords needs-testing-info added; reporter-feedback removed

Thanks @Chouby. I'm afraid I still can't reproduce. Something like ?paged=2&page_id=265 correctly brings me to the second page of the Posts page. Wondering if there's a missing step in the tests instructions or maybe some setting in your environment that is triggering the wrong behavior.

Note: See TracTickets for help on using tickets.