Envira Gallery Blog

Digital Photography Tips, Tutorials and Resources

How to Automatically Delete Images When a Gallery is Deleted in WordPress

How to Automatically Delete Images When a Gallery is Deleted in WordPress

Last updated on Aug 12, 2016 by Waseem Abbas

Do you want to fully remove images from WordPress whenever a gallery is deleted? To save time, you may want to completely delete a photo gallery with all the images in one fell swoop. In this article, we will share how to automatically delete images when a gallery is deleted in WordPress.

By default, WordPress stores all the graphic content in its media library. (You can go to Media » Library to see all your images and other media.) If you delete a default WordPress gallery, it won’t delete the images from your media library.

Since many of you requested for the option to completely delete images when a gallery is deleted, we added this feature to Envira Gallery.

Here’s what you need to do to automatically delete images when a gallery is deleted in WordPress:

  • Step 1. Install the Envira Gallery plugin
  • Step 2. Change the settings to delete images on gallery deletion
  • Step 3. Delete your image gallery and all its images!

Ready to get started? Let’s go!

Step 1: Install Envira Gallery

First thing you need to do is install and activate Envira Gallery plugin.

You can do this by going to Plugins » Add New and search for ‘Envira’. It will show you the option to install the Enivra Gallery plugin.

Install Envira Gallery Lite

In the next step, go ahead and activate the plugin to start creating beautiful image galleries.

Activate Envira Lite Plugin

Upon activation you can go to Envira Gallery » Add New and create a new image gallery.

For more details on what you can do with your Envira Gallery image galleries, check out our guide on how to create an image gallery with thumbnails in WordPress. For now, though, we’ll focus on how to delete an image gallery with all of the images attached to it.

Step 2: Change the Settings to Delete Images on Gallery Deletion

Now you can go to Envira Gallery » Settings and scroll down to look for the option to delete images on gallery deletion.

Simply change the settings to ‘Yes’ at the Delete Image on Gallery Deletion dropdown (By default, it is No).

Delete Images When a Gallery is Deleted

Go ahead and save your settings.

Step 3: Delete Your Image Gallery and All Its Images

Now, anytime you delete a gallery, all of its images will be removed from your media library.

However, if the similar images that are used in this gallery are also used in the other image galleries, then those images will not be deleted from the media library.

We hope this article has helped you to learn how to delete images when a gallery is deleted in WordPress. You may also want to check out our guide on how to allow users to download gallery images in WordPress.

If you like this article, then please follow us on Facebook and Twitter for more free WordPress tutorials.

Using WordPress and want to get Envira Gallery free?

Envira Gallery helps photographers create beautiful photo and video galleries in just a few clicks so that they can showcase and sell their work.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.