Opened 10 years ago
Closed 9 years ago
#31781 closed defect (bug) (worksforme)
Adding a query parameter that has same name as a CPT returns 404
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.1.1 |
Component: | Rewrite Rules | Keywords: | dev-feedback close |
Focuses: | Cc: |
Description
I have a CPT called demo and my payment processor for my shop pass add a demo GET parameter (which i used to confirm if payment was made from a sandbox account) to the callback/return url which leads to 404.
Eg
Say my website is xyz.com and has a CPT demo
A url of this nature http://xyz.com/page-slug/?demo=Y will leads to a 404
I was able to trace the bug to wp-includes/post.php Line 1413 to 1416 (i might be wrong though)
I don't fully understand the core code in that file hence i couldn't provide a patch.
Change History (3)
Note: See
TracTickets for help on using
tickets.
Hello @Collizo4sky, and thank you for the report. The issue you're having happens since the
demo
parameter in the URL is assumed to be the query var for the post type of the same name, you're right with the code example you mentioned.When the
%demo%
rewrite tag is added, that URL parameter is basically reserved by WordPress and cannot used in any other way. I'm not familiar enough with rewrites to judge whether this can or cannot be resolved - maybe it is possible to adjust the regular expression so the parameter is not considered a post type parameter if the value definitely does not apply to the intended usage. I'll move this to the Rewrites section for now.