Bulk restore original images

I want to delete all my full images from Smush Pro, and to restore the original files (.bak). I got 3.000 images in my system, so doing it manually would be a lot of work. Is there any chance to do it automatically?

  • Ash

    Hello happynaut

    There is nothing official, but one of our developers made a script which you can try.

    Can you please add the code in here: https://gist.github.com/UmeshSingla/b3e7d2b08c37c11dd329b05c5270d086 to one of your theme/plugin function.php in the end.

    Or you can just edit hello dolly, and add the code from above source in the end of file, before the closing PHP tag.

    Otherwise mu-plugin is the best option. To create a mu-plugin, go to wp-content/mu-plugins folder. If there is no mu-plugins folder then, create one. Now, inside the mu-plugins folder create file with name anything.php (make sure file extension is .php). Now start with a <?php tag and then put the above code.

    This code adds a UI after the settings area that allows you to restore images using AJAX, not very fancy right now, it just fetches all the smushed attachments and sends a Ajax request for each of them, to restore the image.

    Once all the images are processed, it stops.

    Be careful while adding the code, so that your site doesn't goes down, and keep the FTP handy, in case you face any problem.

    In case you need any help further, please post back.

    Cheers,
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.