[wp-trac] [WordPress Trac] #32795: Duplicate permalinks when using /%postname%/ (was: Duplicate permanlinks)
WordPress Trac
noreply at wordpress.org
Fri Jun 26 12:34:35 UTC 2015
#32795: Duplicate permalinks when using /%postname%/
------------------------------------------+-----------------------------
Reporter: j.conti | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Permalinks | Version: 4.1
Severity: normal | Resolution:
Keywords: needs-patch needs-unit-tests | Focuses:
------------------------------------------+-----------------------------
Changes (by boonebgorges):
* keywords: => needs-patch needs-unit-tests
* version: 4.2.2 => 4.1
* milestone: Awaiting Review => Future Release
Comment:
The same question comes up in
https://core.trac.wordpress.org/ticket/18962#comment:2 and
https://core.trac.wordpress.org/ticket/18962#comment:10. It was not
addressed in [30158], the changeset that ultimately resolved #18962.
There are three options here:
1. Do nothing. If this happens to someone, it's their fault for using
`/%postname%/`.
2. In `wp_unique_post_slug()`, change the duplicate slug check based on
the permalink structure. If it's `/%postname%/`, and `$post_type =
'post'`, dupe checks should include pages as well as posts.
3. In `wp_unique_post_slug()`, have a special case for 'post' that never
allows it to share a slug with a page.
IMO, 1 is not acceptable. 2 and 3 are similar. 2 is less restrictive. It
only forces uniqueness when it's really required based on the current
permastruct. But it will cause problems when someone has permastruct
`/%year%/%postname%/`, creates a post and a page with slug `foo`, and then
changes to `/%postname%/`. Choice 3, while unnecessarily restrictive in
many cases, is more foolproof. 3 seems like the right way to go.
Needs a patch and unit tests.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32795#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list