Opened 2 years ago
Closed 2 years ago
#52586 closed defect (bug) (wontfix)
canonical_redirect drops query
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Canonical | Keywords: | |
Focuses: | Cc: |
Description
The if block at line 206 of wp-includes/canonical.php drops the query portion of the URL. For example:
redirects to
instead of
Change History (2)
#1
in reply to:
↑ description
@
2 years ago
#2
@
2 years ago
- Component changed from General to Canonical
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
- Version 5.6.1 deleted
Hello and thank you for the report.
This occurs because page is a reserved term in WordPress. WordPress Core uses the page=X
query string parameter for pagination of posts, pages and custom post types (page=2
is page 2, which redirects to /my-page/2
).
In your case, redirect_canonical()
is working as intended: the function is checking for the reserved term to determine if it ought to redirect. When the page number doesn't exist it redirects to the first page.
For the purpose of your code, you will need to change the page
query string parameter to use a term that is not reserved, eg myplugin_page
.
As page
is a reserved term used for WordPress Core, I'm going to close this ticket as wontfix
. It's not the most friendly term, sorry, but in this case it's because WordPress can't easily figure out if a reserved term should be preserved for a plugin.
Replying to tdlewis77:
It's worse than I thought. If I enter the URL as
It still redirects to: