#43001 closed defect (bug) (wontfix)
Page Slug and Attachment - Conflict
Reported by: | sebastian.pisula | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.1 |
Component: | Posts, Post Types | Keywords: | has-patch |
Focuses: | Cc: |
Description
I found problem. My attachment have post_name "test" and I want set for my new page post_name "test" and WordPress generate "test-2". I think that problem is with wp_unique_post_slug function in file: wp-includes/post.php:3950:
$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( %s, 'attachment' ) AND ID != %d AND post_parent = %d LIMIT 1";
I attach fix
Attachments (1)
Change History (4)
#3
@
6 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
As noted above, the check for attachment
post type was intentionally added to wp_unique_post_slug()
in [30629] to avoid creating a page with a slug which conflicts with an existing attachment.
The proposed change would introduce a regression. Thanks for the patch though!
Note: See
TracTickets for help on using
tickets.
Note that media items which aren't attached to a post can be accessed via
example.com/my-attachment-slug/
, hence this check withinwp_unique_post_slug()
. Your patch would break that behaviour.