Imagem da Bandeira de Portugal para representar ligação para o conteúdo desta página no idioma Português (pt_PT)
How to Delete Unused Images in WordPress

How to Delete Unused Images in WordPress

Last Updated: May 20, 2024

At some point, we all have had to change, delete articles or products from one of our WordPress sites. Especially those who have online stores, which require constant updates or changes to products and their images. But be aware that WordPress, despite deleting the article when you click the delete button (or send it to the trash), the featured image and other images associated with the article are not deleted. This will generate a snowball on your website, of unnecessary images that will take up space on the server and even make your website heavier and slower. Alright, in this article, I’m going to show you precisely how to delete unused images in WordPress.

Disadvantages of Having Unused Images in WordPress

As I mentioned in the introduction to this article, when you delete articles or products (or any other type of “post”), the images in this article are not deleted. They are still there on the server. And the disadvantages of having them there are the following:

Images are files, and as such, take up disk space on the server. If you have your WordPress site on shared hosting and with disk space limitations, you will come to a time when you will need to clean it up.

The second big disadvantage is the confusion that you can generate between new and old images when you need to access a specific image on your WordPress site.

The third disadvantage is SEO of your WordPress site, which also tends to suffer. Whenever you delete an article, or an image, that article will continue to be indexed by search engines, such as Google or Bing, and many of the searches that Internet users carry out lead to image results. Therefore, if you deleted an article, but the image is still there, it means that the image will continue to be indexed, but without an associated article, which will take your readers or customers to a page that does not exist.

Dangers and Risks of Deleting Images in WordPress

The main risk is deleting important images that are being used elsewhere on the site without being associated with articles or pages, such as logos or icons.

So, How to Delete Unused Images in WordPress?

This is the million-dollar question. How to delete images without making a mistake. Very well, when an image is not associated with an article, product or page, it normally receives the status assigned by WordPress as “Unattached”.

Therefore, the best way to find the images we want to delete is, in the administration menu, access: Media > Library, and in the library administration bar, in the file type filter menu, which is normally set with the value “All Multimedia Files”, click and select the “Unattached” option as shown in the image below:

Then just select the files we want to delete and in “Bulk Actions”, select the “Delete Permanently” option.

When we click on delete permanently we will see a warning in the browser asking if we want to carry out the action, as it will be irreversible, as shown in the image below.

How Not to Make a Mistake Deleting Unused Images

The solution I mentioned above only solves part of the problem, filtering out all images not attached to Articles or Pages. However, there are plugins that may be using certain files for icons or something else, which may appear in the library and which also have the status of “Unattached”. Therefore, what I recommend is that you pay special attention when deleting, that is, we always have to go through everything we want to delete with a fine-tooth comb, because the option to “Delete Permanently” means just that.

That said, you can (and should) always play it safe and perform a backup of your WordPress website, to be able to replace it, if things go wrong.

In short,

If you filter your multimedia files by selecting only those that are in the “unattached” state and pay attention to logos and extra files that are not associated with articles by default (for example, downloadable PDFs), the deletion should go well.

The worst thing that can happen is that you later find out that an article or another, or a part of the website, such as the sidebar, or a file that was available for download, has been accidentally deleted.

So, first step: back up your entire WordPress installation, or with plugins like Updraftplus, you can back up just the images, if you don’t have one beforehand.

Second step: filter the files by “unattached”, and in bulk actions, click on permanently delete the selected ones, taking care to keep logos and other images belonging to the website that are not “attached” to articles or pages. Everything is going to be fine. Good luck.

*(Some articles may have been written or structured with Artificial Intelligence, but they were all reviewed, improved and rewritten by a Human.)

**(May Contain Affiliate Links. It means I may earn a commission every time you click on one of the external links, but do not worry. There is no additional cost to you, on the contrary, Sometimes you can even have extra benefits and discounts. And you will be helping to maintain the blog. For more detailed information consult my Affiliate Disclosure Statement)

How to Delete Unused Images in WordPress

Receive the Guide of THE 10 MOST REQUIRED SKILLS IN A WEB DEVELOPER

Join my List and Receive the guide of THE 10 MOST REQUIRED SKILLS IN A WEB DEVELOPER and so many further news.

I don't send spam! Read my privacy policy for more information.

Was This Article Helpful?

Thank you for your feedback!

Leave a Reply

Your email address will not be published. Required fields are marked *

2023 - 2024© (Copyright) L. R. Neves | All rights reserved. I myself Developed and Implemented the entire Site and am the Main Writer of All Articles.