[wp-trac] [WordPress Trac] #48658: Page and attachment permalink can be silently overwritten when Permalinks are set to /%postname%/ (was: Generating a new post permalink silently overwrites existing attachment permalink)
WordPress Trac
noreply at wordpress.org
Fri Nov 15 22:57:31 UTC 2019
#48658: Page and attachment permalink can be silently overwritten when Permalinks
are set to /%postname%/
--------------------------+------------------------------
Reporter: raamdev | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Permalinks | Version: trunk
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by raamdev):
It looks like this bug is worse than I thought. It doesn’t affect just
attachments. It also affects Pages.
1. Set Settings -> Permalinks to “Post name” (i.e., `/%postname%/`)
1. Publish a Page with a Permalink `/hello-moon/`
1. Publish a Post with a permalink `/hello-moon/` (which you can do!)
The post gets published but the permalink leads you to the Page not the
Post.
It looks like this is because
[[https://github.com/WordPress/WordPress/blob/3a735ec87af655d53838819939bf56efc6e9646e
/wp-includes/post.php#L4388|/wp-includes/post.php#L4388]] assumes that
Pages are in a separate namespace from Posts (this assumption is noted in
an earlier comment:
[[https://github.com/WordPress/WordPress/blob/3a735ec87af655d53838819939bf56efc6e9646e
/wp-includes/post.php#L4360-L4363|/wp-includes/post.php#L4360-L4363]]),
but this is not the case when the Permalinks are set to "Post name"
(`%postname%/`).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48658#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list