Make WordPress Core

Opened 2 months ago

Last modified 2 weeks ago

#60569 assigned enhancement

Generate UUID for media slugs if attachment pages are inactive.

Reported by: peterwilsoncc's profile peterwilsoncc Owned by: antpb's profile antpb
Milestone: 6.6 Priority: normal
Severity: normal Version:
Component: Media Keywords:
Focuses: Cc:

Description

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. 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.

Change History (3)

This ticket was mentioned in Slack in #core-media by joedolson. View the logs.


6 weeks ago

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


2 weeks ago

#3 @antpb
2 weeks ago

  • Milestone changed from Awaiting Review to 6.6
  • Owner set to antpb
  • Status changed from new to assigned
Note: See TracTickets for help on using tickets.