Cleaning media in WordPress

Last Revised: October 2, 2021

Upload images, edit them, crop them and start over. Undoubtedly one of the biggest efforts in many versions of WordPress has been to work on improvements to the multimedia content editing system, mainly images.

When we upload an image (the original) other smaller edits of it are automatically created that will be used as highlights or elsewhere in the template. But later we can edit and trim them. This generates another complete set of images without overwriting the first ones.

If you finally decide that these images are to disappear and delete the original image, all these recreated images that could contain data that you are not interested in being accessible are not deleted.

How can all these generated images be deleted when you delete the original image? Well, activating an element in the configuration file [wp-config.php]:

define('IMAGE_EDIT_OVERWRITE', true);

Keep in mind that if you use a system like a CDN it is possible that these images have already been replicated and distributed around the world, so you will have to do a manual cleaning exercise to remove those images that may never have seen the light.


Seguir con Seguridad para WordPress


About this document

This document is regulated by the EUPL v1.2 license, published in WP SysAdmin and created by Javier Casares. Please, if you use this content in your website, your presentation or any material you distribute, remember to mention this site or its author, and having to put the material you create under EUPL license.