Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#24817 closed defect (bug) (duplicate)

If POST and PAGE have the same slug then PAGE record will be found even if it has been TRASHed

Reported by: lwoods's profile lwoods Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5.2
Component: Permalinks Keywords:
Focuses: Cc:


WP 3.5.2
I set my permalinks to "postname" and then added a POST to a menu. It turns out I had previously had a PAGE with the same name, but I had TRASHed it. But when I clicked on the menu link I got a "404". I traced the queries and it looks like the query only looks for the slug value and does NOT test for whether the slug name has been trashed.
This can be reproduced by adding a page with the title "Test Page" which will create a slug "test-page". Publish it, then trash it. Now, create a POST with the title "Test Page" and publish it. Go check the database. There are two entries in the database with a post_name of "test-page". Now add a menu entry for the POST "Test Page". When clicking on this menu entry you will get a "404". That's because WP is trying to load the PAGE with a slug of "test-page" and there isn't one.

Change History (2)

#1 @DrewAPicture
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #11863.

#2 @SergeyBiryukov
11 years ago

  • Component changed from Menus to Permalinks
  • Keywords needs-patch removed
  • Severity changed from major to normal

Duplicate of #21970.

Note: See TracTickets for help on using tickets.