[wp-trac] [WordPress Trac] #13459: Conflict between post and page slugs/permalinks when permalink setting is set to /%postname%/

WordPress Trac noreply at wordpress.org
Wed Mar 16 19:37:19 UTC 2022


#13459: Conflict between post and page slugs/permalinks when permalink setting is
set to /%postname%/
--------------------------+-----------------------------
 Reporter:  jamescollins  |       Owner:  ericlewis
     Type:  defect (bug)  |      Status:  accepted
 Priority:  normal        |   Milestone:  Future Release
Component:  Permalinks    |     Version:  2.9.2
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+-----------------------------

Comment (by wpmarkuk):

 I found this issue today too. Creating a page and a post with the same
 `slug` results in the post being inaccessible. This seems to be because
 both have the same slug and the page always wins.

 If the permalinks are set to `/%postname%/` the I am assuming that posts
 and pages are using the same "namespace".

 I think the solution here, is that if the permalink structure is set like
 this, when WordPress saves the post slug, it needs to check both posts and
 pages for others with the same slug. I assume this it is only checking
 posts at this time. This was probably a legacy as to when permalinks
 didn't allow `/%postname%/`.

 I don't know what happens when the slug is set, but I assume that there is
 a check for other posts with the same slug (maybe a query). If pages were
 included in this check it could solve the problem.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/13459#comment:62>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list