Ticket #15665 (new defect (bug))
Page name won't work if the parent page has an attachment with the same name
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | General | Version: | 3.1 |
| Severity: | normal | Keywords: | has-patch needs-testing 3.2-early needs-refresh |
| Cc: | westi, ipstenu@… |
Description
It's possible to create a page name that has the same name as an attachment page with the same parent. If you do that, the attachment page takes precedent and it's not possible to display the page with the matching name.
To reproduce:
- Create a page, attach some images to it, save and publish
- Create a child page with the same name as one of images attached to the parent page
---> Result: a page name and an attachment page name that are the same and it's not possible to view the page at http://example.com/parent_page_name/page_name/
Tested with r16708
Making the attachment post type hierarchical fixes it this my tests. Is there any reason attachment post types should not be hierarchical?
Attachments
Change History
This is definitely duplicating another ticket somewhere. But I think this is the first time I've seen it well-explained and with a patch. :)
- Keywords needs-patch added; has-patch, needs-testing removed
- Milestone changed from Awaiting Review to Future Release
Making the attachment post type hierarchical fixes it this my tests. Is there any reason attachment post types should not be hierarchical?
Yes, attachments are not hierarchical because it doesn't make sense to link an attachment to another attachment.
We should find a better way to fix this.
I suspect the real fix here is to find out why we match attachment slugs when looking up root level pages
comment:5
designsimply — 18 months ago
Found two additional cases where it's possible to add pages that conflict with auto-generated pages:
- author/EXISTING_BLOG_USER
- category/EXISTING_CATEGORY
This is in addition to the case originally reported where it's possible to add a page that conflicts with existing attachment pages names for the same parent page:
- PARENT_PAGE/ATTACHMENT_PAGE
- Keywords has-patch needs-testing 3.2-early added; needs-patch removed
Can't reproduce your problem with author and category though. More detailed steps?
comment:10
in reply to:
↑ 3
;
follow-up:
↓ 11
duck_ — 5 months ago
#19683 was closed as a duplicate, apparently root level pages were not susceptible to collisions prior to 3.3. This is might due to changes in get_page_by_path(), see #16687.
Replying to westi:
I suspect the real fix here is to find out why we match attachment slugs when looking up root level pages
get_page_by_path() queries for attachment as well as the specified post type.
Related #17170.
comment:11
in reply to:
↑ 10
duck_ — 5 months ago
Replying to duck_:
apparently root level pages were not susceptible to collisions prior to 3.3.
Sorry for repeating that without double checking. It's wrong.
comment:12
SergeyBiryukov — 3 weeks ago
Closed #20612 as a duplicate.

