#28611 closed defect (bug) (fixed)
Duplicate slug causes multiple posts to be displayed in single post template
Reported by: | SergeyBiryukov | Owned by: | |
---|---|---|---|
Milestone: | 4.0 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Query | Keywords: | has-patch |
Focuses: | Cc: |
Description
This is very similar to #22902, but affects hierarchical post types. See #meta523.
Steps to reproduce:
- Create a hierarchical CPT, e.g. "handbook".
- Add a top-level post called "Getting Started".
- Add another top-level post called "Contributing to the WordPress Codex".
- Add a third post called "Getting Started" and select the previous post as a parent.
- You should get this structure as a result:
/handbook/getting-started/ /handbook/contributing-to-the-wordpress-codex/ /handbook/contributing-to-the-wordpress-codex/getting-started/
- Now go to
/handbook/getting-started/
. Instead of just a top-level "Getting Started" post, you'll see two posts with the same title displayed insingle.php
template.
Has been this way since [13774].
WP_Query
has an assumption that a top-level post of a hierarchical CPT can use name
query var. However, we don't check for duplicate slugs in this case. Looks like hierarchical post types should always use pagename
.
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
Fixed in [28803].