[wp-trac] [WordPress Trac] #17170: Attachment slugs are not unique

WordPress Trac wp-trac at lists.automattic.com
Mon Apr 18 21:02:52 UTC 2011

#17170: Attachment slugs are not unique
 Reporter:  duck_         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  2.8
 Severity:  normal        |   Keywords:  has-patch 2nd-opinion
 From wp_unique_post_slug() and #9726:

 Attachment slugs must be unique across all types.

 It's true that attachment slugs are checked for uniqueness against all
 other object types, however, when inserting an object of another type any
 uniqueness checks do not include attachments. This means that #9539 isn't
 actually fixed if you attempt the steps in the order described (insert
 attachment first followed by conflicting page).

 Fix would be to add 'attachment' to the `post_type IN` clause for
 hierarchical types. See attachments-hierarchically-unique.diff.

 Still puzzling out why/if attachments need to be unique against non-
 hierarchical types since there shouldn't be collisions as attachment URLs
 are subpage style. However, if attachment slugs do need to be globally
 unique then see attachments-globally-unique.diff (not tested so much).

 Related: #9726, #9539, #6437, [11467]

Ticket URL: <http://core.trac.wordpress.org/ticket/17170>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list