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]
- Is it possible to get a page link from its slug?
- How to Protect Uploads, if User is not Logged In?
- Need help with add_rewrite_rule
- After server migration only the homepage works
- Add a menu item to WordPress 3.5 Media Manager
- How to Fix HTTP Error When Uploading Images?
- Enhance Media Manager for Gallery
- remove “index.php” from permalinks
- where is permalink info stored in database?
- Changing permalinks gives me 404 errors on nginx
- How do I add /blog/ as a prefix to permalink structure for blog posts, tag pages, etc.?
- Change media item permalink
- Extend Media Library
- Get Permalink without domain (i.e. get relative permalink) [duplicate]
- How does WordPress create URLs that Apache knows about?
- Strange permalink issue: can’t rename /company-2/ to /company/
- Passing and retrieving query vars in wordpress
- Get the current page URL (including pagination)
- Stop WordPress appending `-2` to the end of my url after i change it
- WordPress 3.5: Setting custom “full URL path to files” in the Media Library?
- Get default permalink structure from pretty URL’s
- Delete an attachment in the WP media modal window
- How to get permalink and title from post ID?
- Why is “/page/2/” not working?
- WordPress Permalinks not working in Apache2 Ubuntu 14.04
- Performance of my permalink structure?
- Permalink format: singular or plural
- Upload images to remote server
- What is the difference between get_post_permalink and get_permalink?
- WordPress matching URLs with trailing tildes
- Get current URL (permalink) without /page/{pagenum}/
- How does WordPress handle permalinks?
- Pretty permalinks for search results with extra query var
- Get page permalink without wpurl
- How can I get the privacy policy page?
- Can I use REST-API on plain permalink format?
- How to show all available images in WP’s media library when using the Polylang plugin?
- WordPress slug issue with non-latin characters
- Rewrite Rule for Multilingual Website, Like qTranslate?
- How to get pretty URLs with add_query_arg in permalinks
- What is the best permalink structure for SEO?
- Change author permalink
- Media library to list images only user uploaded
- Creating custom permalink structure for languages
- Hide permalink and preview button and link on custom post
- Custom post type permalink endpoint
- WordPress 3.5 Media Manager – add a button
- How can I make Capital letter ( upper-case ) permalinks?
- How can I reverse engineer a Permalink to Find the Page?
- Mapping Domains to Permalinks (not multisite)
- How to remove dates from existing permalinks?
- How do I set a custom base URL for standard posts?
- Rendering the uploaded file in a wp.media object
- Removing Parent Page(s) from Permalink
- Why permalinks work with /index.php/%postname% but not with just %postname%?
- How can I bulk delete media and attachments using WP-CLI?
- Setting up WordPress with Custom Permalinks and no .htaccess File?
- Getting the Site URL Including the Front Base
- Does WordPress Change the .htaccess File When Updating?
- Using $_GET variables in the URL?
- Removing the redirect after changing a page’s slug
- How to display a public profile page for registered users with custom slug?
- Removing leading zeros from custom permalink structure
- Must slugs be unique?
- Remove “Insert from URL” link in Media upload – WP 3.5
- Setting 404 page in Nginx
- Which filters or actions to use after a media upload and delete?
- How do I force WordPress to show most recent version of images in the media library?
- WordPress Media Manager 3.5 – default link to
- Proper way to add a button to the top menu of the media library?
- How to get the clean permalink in a draft?
- How to use relative links on my pages?
- How does wordpress keep track of post id when post id is not used in permalinks?
- How to filter to output of the get_permalink() function
- Including category-base in a post permalink results in 404
- How to change ‘with_front” key from an existing custom post type?
- Change slug on post creation
- Does WordPress automatically do 301 redirect if I change permalink
- Protecting direct access to PDF and ZIP unless user logged in (without plugin)
- How can I store page ID in a post instead of other selected permalink?
- How to wp_upload_bits() to a sub-folder?
- WordPress Permalink changes to question mark (?) in URL
- WordPress thinks my custom route is a 404
- Filter by post category in Media Library