Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#26712 closed defect (bug) (duplicate)

Two separate hierarchical CPT's can't have a top-level post with the same slug

Reported by: jfarthing84's profile jfarthing84 Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.8
Component: Posts, Post Types Keywords:
Focuses: Cc:


If you create two separate, non-hierarchical post types, you can create a top-level post within both of them with the exact same slug. Yet, if you have two separate hierarchical post types, you can't.

The problem is when it is hierarchical, wp_unique_post_slug also takes into consideration the post parent. Of course, two top-level posts would both have a post parent of 0.

I understand that the post parent should be checked for child posts as they are under their parent's "tree". However, if there is no post parent, shouldn't that part be left out of the check query?

Attachments (1)

26712.patch (1.1 KB) - added by jfarthing84 10 years ago.
Check for hierarchical post parent in wp_unique_post_slug

Download all attachments as: .zip

Change History (2)

10 years ago

Check for hierarchical post parent in wp_unique_post_slug

#1 @SergeyBiryukov
10 years ago

  • Component changed from General to Post Types
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #18962.

Note: See TracTickets for help on using tickets.