[wp-trac] [WordPress Trac] #59766: Custom post type archive URLs are being resolved in an unexpected way if a page with the same slug exists and the URL's casing doesn't exactly match the custom post type's rewrite slug
WordPress Trac
noreply at wordpress.org
Thu Jan 18 15:41:44 UTC 2024
#59766: Custom post type archive URLs are being resolved in an unexpected way if a
page with the same slug exists and the URL's casing doesn't exactly match
the custom post type's rewrite slug
-------------------------------+------------------------------
Reporter: nonverbla | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: 6.3.2
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-------------------------------+------------------------------
Comment (by nonverbla):
So, I just learned about WordPress' policy of never introducing breaking
changes. Then maybe there is another way to help people to "do it right"
and save them the trouble I went through to find this?
How about introducing a hint on all appropriate docs pages
(`register_post_type` , `register_taxonomy` , `add_rewrite_endpoint`,
`add_rewrite_rule`, ... come to mind)? Something like:
"Please prefer all-lowercase words for your archive and rewrite slugs."
"Please prefer all-lowercase words when registering custom rewrite rules."
"..."
Or even some kind of `doing_it_wrong` warning that is being logged if
rewrite rules containing uppercase letters are detected and `WP_DEBUG` is
`true`? This "feature" was causing me a few very stressful moments when it
was randomly popping up a while back on a client's website.
It was also very hard to debug, since I never had the idea to actually try
the URL with capital letters in my manual tests. In the end, I only found
it by writing a custom logger that would send me an email when the
response for the URL was looking wrong...
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59766#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list