WordPress.org

Plugin Directory

Media File Renamer

Auto-rename the files when titles are modified and update and the references (links). Manual Rename is a Pro option. Please read the description.

Check the FAQ on the official website, here: http://apps.meow.fr/media-file-renamer/faq/. 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 :)

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;
}

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.

Requires: 3.5 or higher
Compatible up to: 4.5.3
Last Updated: 2 months ago
Active Installs: 20,000+

Ratings

4.2 out of 5 stars

Support

1 of 6 support threads in the last two months have been marked resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,2,2 100,1,1
0,1,0 100,1,1
100,1,1
100,1,1
100,1,1 100,1,1
100,1,1 100,1,1
100,3,3
100,1,1
50,2,1
100,3,3
50,2,1 100,1,1 100,1,1
100,1,1 100,1,1 100,1,1 100,2,2 50,2,1 100,1,1
100,1,1 50,4,2 100,2,2
100,2,2 100,1,1 100,1,1
50,2,1 100,1,1 100,1,1 50,2,1 100,1,1 100,1,1 100,2,2 100,1,1
100,1,1
100,1,1 100,1,1 100,1,1
100,1,1
0,1,0
100,1,1 100,1,1
100,2,2
100,1,1
0,1,0 100,2,2
100,1,1 100,2,2 67,3,2 100,1,1
100,2,2
100,1,1
100,2,2 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1
100,2,2 100,1,1 100,1,1
100,2,2
100,1,1
100,2,2 100,3,3 100,1,1 100,1,1
100,1,1 100,2,2 100,1,1 100,4,4
100,1,1 100,1,1 100,1,1
100,1,1 100,1,1 100,2,2 100,1,1
100,1,1 100,1,1
100,1,1 100,1,1 100,1,1
100,1,1