Opened 5 weeks ago
Last modified 5 weeks ago
#65042 new enhancement
Alter Attachment page slug behaviour
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | trivial | Version: | |
| Component: | Posts, Post Types | Keywords: | |
| Focuses: | Cc: |
Description
Since files in the media library are stored as post types, each media file uploaded takes a unique slug with it matching its file name which is then used to create the attachment page url.
The problem is that this seldom used page hogs slugs which can’t be used in other post types like pages, posts, public custom post types etc.
Eg : If I upload an image named “Planet X” I cannot have a page /planet-x page anymore as that slug is taken by the image page (which is again rarely used)
There is no straight forward way to recover this slug back too as media library is not represented as a post type in the admin UI.
I propose that media slugs be appended by an alphanumeric string on file upload to avoid hogging valuable slugs from other public post types.
Change History (4)
#1
in reply to:
↑ description
@
5 weeks ago
#3
in reply to:
↑ description
@
5 weeks ago
- Severity changed from minor to trivial
Replying to namith.jawahar:
Changing slug generation (random suffixes) would likely hurt SEO more than it helps:
Breaks clean, readable URLs and can impact image/content sitemap structure
Reduces keyword relevance in image filenames
Can make debugging, CDN usage, and asset tracking harder
I think this can be handled during site building:
If a page is important → reserve that slug
Use slightly adjusted image names (e.g., planet-x-image.jpg)
I think best addressed through content planning and Information Architecture (IA), rather than modifying slug generation logic.
#4
@
5 weeks ago
The attachment pages are not used by most of WordPress users for sure and most don't even know its there and only serving as SEO spam. I didn't suggest a toggle to disable it completely thinking about backward compatibility. while solvable via plugins, the SEO spam this creates is real and not really desirable in a modern CMS.
Replying to namith.jawahar:
There is a way to do it although it is not very obvious - you have to edit an attachment, then click "Screen Options" and check the "Slug" checkbox.
There are plugins which do this already - for example:
https://wordpress.org/plugins/disable-media-pages/