Meow Apps

Media File Renamer: Debug Issues

Navigation Close

I am actively working on this page based on users’ request, issues, and questions. I am sorry if it seems a bit messy; I will make it clearer and better.

There are many themes and plugins available. Some of them manage images their own way, create their own metadata, hide important information in your database. Of course, Media File Renamer detects most of it and works perfectly on standard installs, but it can’t cover 100% of the WordPress installs, especially if they are a bit… exotic :) In those cases, the reference to the file might not be renamed and appear broken.

Recommendations

Before using the plugin, backup! That’s what you should do anyway, every day, or once a week, and before using a plugin that deletes/modifies files or database entries. Keep in mind that the plugin also has an Undo feature, you can enable it in the settings, then rollback a specific file to its original filename.

Timeouts, Big Installs, Slow servers

If you have a big install and/or a slow server, then you might experience timeouts. The plugin runs 2 to 4 queries on your database. Those queries replace the old filenames by the new filenames.

Here are a few workarounds:

I have been thinking of an alternative that could work: making the renaming asynchronous and renaming the files in the posts, parsing them one by one. Of course, that would be a bad alternative for those with no such issues as the plugin would become slower. Unfortunately, there are no other alternatives. I don’t think it’s an issue in the long run, installs are getting better, and hosting services faster.

Have you moved your WordPress to a new hosting service?

This is a really annoying issue as it is very technical, and difficult to resolve. It also impacts your WordPress install dramatically, even though… at first, everything seems to work perfectly.

Impacted WordPress installs are the ones using a lot of UTF-8 files. It means they contain a lot of non-ASCII characters, such as commas, quotes, accents, special characters, etc. Many of my clients had issues related to that.

How to resolve it? It’s best to ask your hosting service. But here is a quick idea for you: remove all the content of your /uploads folder, and re-upload the content of this folder from your previous hosting service by FTP using an option that enforces the usage of UTF-8.

My install is broken; how to debug?

Maybe it is not broken: The Cache Issue

WordPress installs are very cached nowadays. By plugins, by hosting services, CDN, etc. After renaming your files, you need to clear your cache. Not only your browser cache, but also your hosting service’s cache. And if you are using plugins to make your website faster, they will also have an option to reset your cache.

Sometimes the cache is cleared automatically, and you might know that. But for example, a plugin like WP Rocket (that does cache) doesn’t react when the meta for a post is updated, it does only clear its cache when the post itself is updated. So this is important: don’t believe the caching plugins are perfect, and clear your cache regularly.

Repair your WordPress

If there is no backup, then there are two things you can try:

Using The Renamer’s Actions & Filters

If you have a developer working for you, then he/she will be able to understand how your install work, and to teach Media File Renamer how to update those references. You can use the mfrh_url_renamed (if you want to handle the new URL for this filename) or the mfrh_media_renamed (if you want to handle the filename on your server) actions. Have a look at the examples in the plugins/custom.php file in the plugin directory.