#28611 closed defect (bug) (fixed)
Duplicate slug causes multiple posts to be displayed in single post template
| Reported by: | SergeyBiryukov | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.0 |
| Component: | Query | Version: | 3.0 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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.phptemplate.
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Fixed in [28803].