Media File Renamer


The Media File Renamer is a WordPress plugin that physically renames media files nicely for a cleaner system and for a better SEO. Please read this description.

IMPORTANT. This is originally an automatic renamer based on the Media title. This plugin features were all meant to be automatic depending on the title of the Media. Manual Rename (and a few more features) were added two years later, in a Pro version. I add complex features based on requests usually in the Pro to be able to maintain the quality of the plugin and its support.

HOW IT WORKS. The plugin automatically renames your media filenames depending on their titles. When files are renamed, the references to it are also updated (posts, pages, custom types and their metadata). A new column in the Media Manager will display to you the new ideal filename and a button will allow you to rename it straight away. You can lock and unlock the renaming automatic process through little icons. There is also a little dashboard called File Renamer in Media that will help you rename all your files at once. Advanced users can change the way the files are renamed by using the plugin’s filters (check the FAQ). There is also a LOCK option on every image to avoid the filename to be modified any further.

PRO VERSION. The Pro Version gives a few more features like manual renaming, renaming depending on the post the media is attached to or the content of the alternative text (ALT), logging of SQL queries and a few more options. A good process is to actually let the plugin do the renaming automatically (like in the free version) and to do manual renaming for the files that require fine tuning.

BE CAREFUL. File renaming is a dangerous process. Before renaming everything automatically, try to rename a few files first and check if all the references to those files have been properly updated on your website. WordPress has so many themes and plugins that this renaming process can’t unfortunately cover all the cases, especially if other plugins are using unconventional ways. If references aren’t updated properly, please write a nice post (not an angry one) in the support threads πŸ™‚ I will try my best to cover more and more special cases. In any case, always make a backup of your database and files before using a plugin that alter your install. For backup, you can use such a plugin as UpdraftPlus. Also, it your website seems broken after a few renames, try to clear your cache. The cached HTML will indeed not be linked to the new filenames.

FOR DEVELOPER. The plugin can be tweaked and reference updates enhanced for your themes/plugins. Have a look here.

JUST TO MAKE SURE. This plugin will not allow you to change the filename manually in its standard version. The Pro Version is required. If you are about to write an angry review because this feature is not available, please mention that you read the whole description.

This plugin works perfectly with WP Retina 2x, WPML and many more. Is has been tested in Windows, Linux, BSD and OSX systems.

Languages: English, French.


Do you have suggestions? Feel free to contact me at Totoro Times.


  • Type in the name of your media, that is all.
  • Special screen for bulk actions.
  • This needs to be renamed.
  • The little lock and unlock icons.
  • Options for the automatic renaming (there are more options than just this).


  1. Upload media-file-renamer.php to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Try it with one file first! πŸ™‚


Check the FAQ on the official website, here: The following is to enhance the plugin for your own install and is aim to advanced users and developers. If you want to quickly try to use the following filters and actions, please have a look a the file called mfrh_custom.php in the plugin, uncomment some code and hack it πŸ™‚

Installation Instructions
  1. Upload media-file-renamer.php to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Try it with one file first! πŸ™‚
Change the way the files are renamed

If you are willing to customize the way the file are renamed, please use the mfrh_new_filename filter. The $new is the new filename proposed by the plugin, $old is the previous one and $post contains the information about the current attachment.

add_filter( 'mfrh_new_filename', 'my_filter_filename', 10, 3 );

function my_filter_filename( $new, $old, $post ) {
  return "renamed-" . $new;

The mfrh_replace_rules filter is a bit simpler and allows you to customize specific characters or bit of strings, like with the example below.

add_filter( 'mfrh_replace_rules', 'replace_s_by_z', 10, 1 );

function replace_s_by_z( $rules ) {
  $rules['s'] = 'z';
  return $rules;
Update References

You can also update the references to the files or URLs which are renamed/modified by using the following filters. If you themes or another plugins are storing those references by yourself, then this is a chance to achieve this πŸ™‚

The $post is an array containing information about the media (as it is like a post), and you can use the $original_image_url and $new_image_url to do the required renaming:

add_action( 'mfrh_url_renamed', 'my_url_renamed', 10, 3 );

function my_url_renamed( $post, $orig_image_url, $new_image_url ) {
  return "renamed-" . $new;

This is the same as above but it is about the physical filepath on your filesystem:

add_action( 'mfrh_media_renamed', 'my_media_renamed', 10, 3 );

function my_media_renamed( $post, $old_filepath, $new_filepath ) {
  return "renamed-" . $new;

You are welcome to create plugins using Media File Renamer using special rules for renaming. Please tell me you so if you make one and I will list those plugins here.


Great Plugin!

This plugin does a great job – and it’s user friendly! I have a huge number of images on my website which means many potential loading speed problems – using this in conjunction with other optimizing plugins has made my site much faster loading! Many Thanks!

Read all 157 reviews

Contributors & Developers

“Media File Renamer” is open source software. The following people have contributed to this plugin.


“Media File Renamer” has been translated into 2 locales. Thank you to the translators for their contributions.

Translate “Media File Renamer” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.



  • Update: Now uploading Media into Post rename the filename accordingly.


  • Fix: Rename on Upload issue in a few cases.


  • Update: Improved Rename on Upload.
  • Fix: Annoying warning (but it was not causing any error).


  • Update: Manual Rename allows a new extension.


  • Add: Little API.


  • Add: Bulk rename in the Media Library.


  • Add: Table with the filenames before and after renaming + CSV Export (works with Redirection plugin).


  • Add: Button “Undo All” to restore all the original filenames.
  • Fix: Avoid the Numbered Files and Force Renamed options to be activated at the same time.


  • Fix: Compatibility with WPML.
  • Fix: There was a compatibility issue with retina.


  • Add: New button “Lock All”
  • Fix: Button “Unlock All and Rename” was not really unlocking everything.


  • Fix: Sometimes numbered files were renamed something like abc-2-2.jpg.
  • Update: Rename with lowercase to avoid issues.
  • Add: Option for Pro, Media Title is synchronized with Title of Attached Post.


  • Add: mfrh_replace_rules filter allows you to personalize the renaming at the character level.


  • Fix: Update system fixed and code cleaning.


  • Fix: Better handling of umlauts.
  • Info: There will be an important warning showing up during this update. It is an important annoucement.


  • Fix: Slug was not getting renamed after recent WP update.
  • Fix: Tiny fixed to avoid notices.
  • Add: Support for WPML Media (thanks to David GarcΓ­a froml WPML Team).


  • Fix: Should work with more plugins/themes, WooCommerce for example. The updates aren’t done only on the full URLs of the images in the DB now but also on the relative uploads path as well.
  • Info: If you have some time, please review me nicely at Thanks to you, I get a lot of motivation to make this plugin better πŸ™‚


  • Add: Option to rename depending on the ALT. Useful if you get interesting information in your ALT.
  • Update: Sync ALT also works with Attached Post Title.
  • Fix: Better handling of norwegian letters (will improve this kind of things over time).


  • Add: Rename the file during upload, based on the media title. Not by default, check the options πŸ™‚


  • Fix: Logging could not be enabled.
  • Update: Code cleaning.


  • Update: The UI was a bit modified and enhanced. I also think it is simpler and cleaner.
  • Update: Removed the auto-flagging process which was causing issues on sizeable installs.


  • Fix: The references in the excerpts are now also updated (they are used by WooCommerce).
  • Add: Undo button. When the media is unlocked and has been renamed, you have a Undo button. You need to active this in the option.
  • Update: Everything has been moved into the Meow Apps menu for a cleaner admin.


  • Fix: Removed Flattr.
  • Add: Additional cleaning to avoid extensions sometimes written in the title by WP.
  • Add: Clean out the english apostrophe ‘s during the creation of the new filename.


  • Add: New option to remove the ad, the Flattr button and the information message about the Pro.
  • Fix: Renaming slug was not working well after latest WordPress updates
  • Fix: Use direct links for all my images and links to follow WordPress rules.


  • Info: A file mfrh_custom.php has been added. If you are an advanced users or a developer, please have a look at the FAQ here: Since I am only one developer, I can’t cover all the renaming cases we have (since sometimes plugins keep their own links to the filenames; such as WooCommerce). That will make it easy to advanced users to push Media File Renamer to cover more and more special cases.


  • Change: Modified description and information about the mfrh_url_renamed and mfrh_media_renamed filters.
  • Add: New option to force renaming file (even though the file failed to be renamed). That will help PRO users to fix their broken install, often after a migration for example (often related to change of hosting service using different encoding).
  • Fix: Click on lock/unlock doesn’t take you back to the first page anymore.
  • Fix: Little naming issue when numbering + custom filter is used.


  • Add: Lock/Unlock icons in the Media Manager.
  • Add: Rename depending on the title of the post the media is attached to.


  • Update: WordPress 4.4.
  • Add: Add -2, -3, etc… when filenames are similar. Pro only.
  • Fix: There was a glitch when .jpeg extension were used. Now keep them as .jpeg.


  • Fix: There was a possibility that the image sizes filenames could be overwritten wrongly.
  • Update: Rename the GUID (File Name) is now the default. Too many people think it is a bug while it is not.
  • Add: UTF-8 support for renaming files. Before playing with this, give it a try. Windows-based hosting service will probably not work well with this.
  • Fix: Auto-Rename was renaming files even though it was disabled.
  • Update: If Auto-Rename is disabled, the Media Library column is not shown anymore, neither is the dashboard (they are useless in that case).
  • Add: Metadata containing ‘%20’ instead of spaces are now considered too during the renaming.


  • Add: Update the metadata (true by default).
  • Fix: Guid was renamed wrongly in one rare case.
  • Fix: Double extension issue with manual renaming.


  • Fix: Couldn’t rename automatically the files without changing the titles, now the feature is back.
  • Fix: Better ‘explanations’ before renaming.
  • Fix: Should work with WPML Media now.
  • Fix: Manage empty filenames by naming them ’empty’.


  • Add: Option to automatically sync the alternative text with the title.
  • Add: Filters and Actions to allow plugins (or custom code) to customize the renaming.
  • Fix: Avoid to rename file if title is not changed (annoying if you previously manually updated it).
  • Change: Plugin functions are only loaded if the user is using the admin.


  • Add: Many new options.
  • Add: Pro version.
  • Add: Manual file rename (Pro).
  • Update: Use actions for renaming (to facilitate support for more renaming features).


  • Fix: Texts.
  • Fix: Versioning.


  • Add: New option to avoid to modify database (no updates, only renaming).
  • Add: New option to force update the GUID (aka “File name”…). Not recommended at all.
  • Fix: Options were without effect.
  • Fix: GUID issue.


  • Fix: issue with attachments without metadata.
  • Fix: UTF-8 title name (i.e. Japanese or Chinese characters).


  • Add: option to rename the files automatically when a post is published.


  • Fix: the ‘to be renamed’ flag was not removed in a few cases.


  • Fix: issue with strong-caching with WP header images.
  • Fix: now ignore missing files.
  • Change: renaming is now part of the Media Library with nice buttons.
  • Change: the dashboard has been moved to Tools (users should use the Media Library mostly).
  • Change: no bubble counter on the dashboard menu; to avoid plugin to consume any resources.


  • Fix: ‘<?’ to ‘<?php’.
  • Add: French translation.
  • Change: Donation button (can be removed, check the FAQ).


  • Fix: Ignore ‘Header Image’ to avoid related issues.
  • Change: Updated screenshots.
  • Change: ‘To be renamed’ filter removed (useless feature).


  • Change: Rename Dashboard enhanced.
  • Change: Scanning function now displays the results nicely.
  • Change: Handle the media with ‘physical’ issues.


  • Fix: Works better on Windows (file case).
  • Fix: doesn’t add numbering when the file exists already – was way too dangerous.
  • Change: warns you if the Media title exists.
  • Fix: Removed a ‘warning’.


  • Fix: Media were not flagged “as to be renamed” when the title was changed during editing a post.
  • Change: Internal optimization.
  • Add: Settings page.
  • Add: Option to rename the slug or not (default: yes).


  • Fix: Works with WP 3.5.
  • Change: Update the links in DB directly.
  • Fix: number of flagged media not updated straight after the mass rename.
  • Fix: the “file name” in the media info was empty.
  • Fix: SQL optimization & memory usage huge improvement.


  • Add: New view “To be renamed” in the Media Library.
  • Add: a nice counter to show the number of files that need to be renamed.
  • Fix: the previous update (0.4) was actually not containing all the changes.


  • Support for WPML
  • Support for Retina plugins such as WP Retina 2x
  • Adds a ‘-‘ between the filename and counter in case of similar files
  • Mark the media as to be renamed when its name is changed outside the Media Library (avoid all the issues we had before)
  • The GUID is now updated using the URL of the images and not the post ID + title (
  • Double-check before physically renaming the files.


  • Corrections + improvements.
  • Handles well the ‘special cases’ now.
  • Tiny corrections.


  • First release.