Support » Plugin: Media File Renamer - Auto & Manual Rename » Broken images on save in Gutenberg

  • Resolved Cory Hughart


    This is something of a resurrection of a previous thread that is now closed:

    I have the “Rename on Post Save” option turned on, and I can confirm via the logs that this plugin is attempting to update the content/excerpts in the database after the post is saved, and when I check the front-end or refresh the editor the images are there.

    However, since the plugin is changing the image URL in the database directly, the editor itself does not update unless you: 1) upload the image, 2) publish or save a draft, and 3) refresh the editor before proceeding. Otherwise, if you save again after the first time, the post content is overwritten with the old image URLs still present in the editor.

    It’s taken me a little while to figure out this workflow, but forgetting means fixing several images per post, every post. I’m not sure there is a simple resolution to this unless this issue is ever resolved (which I doubt will happen, but who knows):

    Since Gutenberg is an integral part of the WordPress experience now, I hope this plugin can get some updates geared towards Gutenberg. Another possibility would be renaming on upload by filtering wp_insert_post, so that the file would already be renamed when it’s inserted into the editor without needing any Gutenberg integration (maybe you’ve gone down that road and ran into issues, I don’t know).

    I don’t think this is a support question, since I think the only resolution for now is the workflow above, but I hope this might be fully resolved some day.

Viewing 1 replies (of 1 total)
  • Plugin Author Jordy Meow



    Yes, I am happy you actually looked into this 🙂 I don’t recommend that option for that reason. It used to work, then with the way it works with draft, asynchronous saving, page-builders, etc. It’s a super-dangerous option to use. I kept it because some people are using it (and I got many complaints when I tried to remove it).

    The problem is that it also depends on the method you use. We could make it work with Gutenberg and 2-3 use-cases, but we will always find a way to make it fail.

    I am only looking forward to removing that option, unfortunately. Except if WordPress changes the way it updates posts asynchronously, that would be the only way. But I am not willing to hack the WordPress process to try to make it work, it’s too dirty and dangerous.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.