WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 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 Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.8
Component: Posts, Post Types Keywords:
Focuses: Cc:

Description

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 8 years ago.
Check for hierarchical post parent in wp_unique_post_slug

Download all attachments as: .zip

Change History (2)

@jfarthing84
8 years ago

Check for hierarchical post parent in wp_unique_post_slug

#1 @SergeyBiryukov
8 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.