This’ll add a slug field to the edit attachment page, which’ll allow you to independently change it when and how you choose to.
Drop it into a plugin or your theme’s functions.php
;
function wpse_12405_edit_attachment_name( $fields, $post ) {
$fields['post_name'] = array(
'label' => __( 'Slug' ),
'value' => $post->post_name,
);
return $fields;
}
add_filter( 'attachment_fields_to_edit', 'wpse_12405_edit_attachment_name', 10, 2 );
function wpse_12405_save_attachment_name( $attachment, $POST_data ) {
if ( ! empty( $POST_data['post_name'] ) )
$attachment['post_name'] = $POST_data['post_name'];
return $attachment;
}
add_filter( 'attachment_fields_to_save', 'wpse_12405_save_attachment_name', 10, 2);
Related Posts:
- Media items hogging pretty permalinks
- Stop WordPress from reserving slugs for media items?
- Make attachment pages require a base url
- shortcode to output multiple images urls from media library id
- Adding File Extensions to Attachment Page Permalinks
- How to link to “most recent” document in the Media Library?
- How do I fix permalink and media library issues on a LEMP stack?
- WordPress auto generates small medium and large of an image on upload, how can we guess their links?
- Media Gallery Images – safe to change permalink?
- Migrated from Windows to Linux. Any bulk methods for fixing case sensitivity?
- Images in media library have suddenly disappeared
- Media/attachment urls don’t redirect with fake URL structure
- how do prevent wordpress from creating permalinks for media files
- Double Slash After Media Path (uploads//)
- Code snippet to add filter pre_post_link to change Media URL (post_type attachment permalink/slug)
- WordPress image title attribute becomes permalink? [duplicate]
- Changing permalinks gives me 404 errors on nginx
- Does WordPress automatically do 301 redirect if I change permalink
- Move WordPress to subdirectory, keep ALL URLs
- Remove parent slug for child pages
- Best plugin to manage media library? [closed]
- How to Removing fields from the Media Uploader/Gallery on a Custom Post Type Edit Page
- How can I Rewrite a ‘page’ URL based on query string parameters?
- Is it possible to list post attachments in a sub URL endpoint with a dedicated template?
- How to edit the slug/permalink in Gutenberg?
- Mass Permalink Changer
- Attachment page 404 not found when image is attached to post
- What happens when permalink settings are updated?
- Change permalink for a single post type only
- How to achieve a clean custom permalink solution?
- How can I make my .htaccess file writeable by wp-admin?
- WordPress 3.5 Media Manager – add a button
- add new permalink structure from dynamic page
- query_vars in plugin not working?
- Custom taxonomy rewrite using tax name instead of rewrite slug
- How to retrieve alt attribute for an attachment (uploaded image)?
- How do I get all the URLs from my WordPress site?
- How to get media objects
- Why is add_rewrite_endpoint incompatible with /%category%/%postname%/ permalink structure?
- Post edit – Media Library – Only get images from current post
- Custom query var rewriting with only variable
- Date Archives’ Permalinks under Category folder
- get permalink of page children in loop
- move_uploaded_file() not working on wordpress front end
- My Media Library is broken across all my subsites
- How to get the return value of wp.media({ frame: ‘post’ }) in all cases?
- Category with the same slug
- Do WordPress Permalinks Refer to a Lookup Table in the Database?
- Post preview gives 404 when permalinks are purely date based
- Change Buddypress Admin Profile Page Permalink
- how do links move when I move my site?
- Permalink for PDF of article
- Comment author url link is wrong? How to change from authors/ to author/
- rename ‘page’ URL fragment in pretty permalinks
- Why can’t change the permalink of my page/post?
- Auto delete pictures in media library by age
- Redirecting “wrong” but working links to their canonical URL in order to prevent search engine penalties (e.g. /123/ at the end of URLs)
- Direct link to post when multiple categories are selected
- Getting an ID from a URL, why can WP do this itself, but none of of the functions provided get it right?
- Ignore postname in permalink
- Fix 404 error after changing permalink structure
- How can I set up a secondary permalink structure?
- External PHP file & Pretty Permalink
- how to set up wp in folder within static website?
- WordPress permanent links not working (the weird way)
- Permalink Structure not updating .htaccess
- How to enable %postname% permalinks on Mac?
- How do I rewrite attachment urls when permalink structure contains %category%?
- How do I structure my permalinks in WordPress?
- How to change URL from /%postname%/ to custom-name/%category%/%year%/%monthnum%/%day%/%postname%/
- WordPress Attachment Page URL Rewrite!
- Customize URL for specific tags archive
- Can’t upload format files on media library
- Permalink prefix change
- why wordpress keeps redirecting to old page after deleting it?
- Post images are not displayed in media library
- How to make the media library searchable by image title
- Permalink structure /page/page/cpt-post gives 404 with pagination
- Changing permalink structure for Posts
- Rewrite posts url as they’re all children of a page
- WordPress permalinks first word title
- I can get the permalink or the excerpt to work correctly, but not both
- WordPress permalink issue on AWS
- Permalink Rewrite with Archive – Archive gets 404
- WP Admin Bar not showing with custom permalink structure for pages
- get_permalink wrongfully returns only year and month and not all the link
- Link to most recent child page
- Automatic -1 suffix being added to the permalinks of a page when the page does not exist
- Why doesn’t WP update my .htaccess file?
- WordPress permalink still not working (error or not understood?)
- Permalink for pages
- Problem when i configure permalink
- Getting the top level permalink using get_post_ancestors()
- What is the issue with our links? It creates a loop
- Media Custom Fields – get a value with PHP
- Strip category base from URL?
- add_image_size is not generatin images of correct dimensions
- Does the error “A structure tag is required when using custom permalinks.” mean my permalinks haven’t saved?
- How to make my custom permalink pull up the correct post
- How to Set Both Category and Sub-Category Level at Root. It should also obey post rule as /category/sample-post and /sub-catgeory/sample-post?