Make WordPress Core

Opened 8 months ago

Last modified 2 months ago

#55500 new enhancement

Ability to change slug of Attachments

Reported by: nidhishanker's profile nidhishanker Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.9.2
Component: Media Keywords: reporter-feedback
Focuses: performance Cc:


As WordPress facilitates to change permalink/slug of Post Types, it is suggested to enable editing the slug of Attached Media.

Right now after uploading an image, it is possible to update all information except the media slug.

In my case, the slug had some encrypted or random character and now I want to change the slug of Attachment.

Note: Required screenshots are attached.

Attachments (2)

after-image-upload.png (2.9 MB) - added by nidhishanker 8 months ago.
Attachment after uploading media.
after-image-renamed.png (2.2 MB) - added by nidhishanker 8 months ago.
Attachment after renaming media but permalink remains steady.

Change History (6)

8 months ago

Attachment after uploading media.

8 months ago

Attachment after renaming media but permalink remains steady.

#1 @desrosj
7 months ago

  • Component changed from General to Media

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

5 months ago

#3 @antpb
5 months ago

  • Keywords reporter-feedback added; needs-patch removed

Hi @nidhishanker ! There was some discussion about this in a recent media meeting and we had some concerns around this feature giving folks the ability to break content without knowing. In posts, it is easy to change slugs and redirect as we need because it is the final content rendered when making a request. For attachments it could conflict with existing content.

Do you have any thoughts around how this could be avoided? Ideally a feature like this would account for all uses of the Media to update them, but I suspect theres some hidden complexity in there.

#4 @verygoode
2 months ago

Howdy @nidhishanker, @antpb!

There is a Slug option for attachments. I believe it is hidden by default to prevent potential problems. E.g. broken links...etc

To reveal it

  1. Edit the selected attachment
  2. Open Screen Options
  3. Check/enable the Slug option.
  4. The slug field will be available at the bottom of the page and can be edited.
  5. Update once done.

This will change the slug and also free it up so it can be used by other post types.

Not sure if this issue needs to remain open, unless it's converted into an enhancement to improve this behavior.

Last edited 2 months ago by verygoode (previous) (diff)
Note: See TracTickets for help on using tickets.