[wp-trac] [WordPress Trac] #60569: Generate UUID for media slugs if attachment pages are inactive.

WordPress Trac noreply at wordpress.org
Mon Feb 19 02:36:19 UTC 2024


#60569: Generate UUID for media slugs if attachment pages are inactive.
---------------------------+-----------------------------
 Reporter:  peterwilsoncc  |      Owner:  (none)
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Media          |    Version:
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 For hierarchical post types, WordPress compares slugs with those used by
 attachments to avoid collisions. The effect of this is that a page can not
 have the same slug as an uploaded image.
 [https://core.trac.wordpress.org/browser/tags/6.4.3/src/wp-
 includes/post.php?marks=5100-5101#L5100 Source code.]

 This remains the case now that attachment pages have been disabled by
 default.

 As the attachment pages slugs are now largely meaningless on new WordPress
 installs, the media slugs should not reserve nice names and prevent pages
 from using them. For example, a media file with the name `about-us.png`
 should not prevent the page `about-us` from existing.

 Steps to reproduce above:

 1. Install WordPress 6.4 or later
 2. Go to Dashboard > Media > Add new media file
 3. Upload the file `about-us.png`
 4. Go to Dashboard > Pages > Add new page
 5. Title the page `About Us` and publish
 6. Observe the page's slug is `about-us-2`

 If the attachment pages are disabled, the URLs for the media pages (as
 opposed to the image) can use `wp_generate_uuid4()` for the slug to avoid
 reserving nice names and preventing their use on available permalinks.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60569>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list