Envira Gallery Blog
Digital Photography Tips, Tutorials and Resources
Digital Photography Tips, Tutorials and Resources
by Waseem Abbas on Jul 15, 2016
Do you want to remove multiple blog post thumbnails from your site? Sometimes you may want to remove all your featured images, when redesigning your site for example, and you don’t want to have to remove each one manually. In this article, we will share how to bulk remove blog post thumbnails in WordPress.
By default, WordPress doesn’t allow you to remove featured images in bulk. However, you may have hundreds of post thumbnails, and it would take an enormous amount of time to remove each of them, one by one.
Thankfully, there is a solution.
This can be done by adding a simple script to your theme files. This script is a database query, and it helps you to remove several blog post thumbnails from your site all at once.
To install the script, simply add the following code to your theme’s functions.php file:
global $wpdb; $wpdb->query( " DELETE FROM $wpdb->postmeta WHERE meta_key = '_thumbnail_id' " );
After adding the code, make sure to save the document. Now all of your blog post thumbnails will be removed. (However, all of the images you have uploaded will not be deleted, and they will still be in your Media Library.)
Important: make sure to remove this script from your functions.php file immediately after saving it. Otherwise, whenever you add a new featured image in WordPress, this script will keep removing it.
We hope this article has helped you to learn how to bulk remove blog post thumbnails in WordPress. You may also want to check out our guide on how to fix missing post thumbnail issue in WordPress.
If you like this article, then please follow us on Facebook and Twitter for more free WordPress tutorials.
Envira Gallery helps photographers create beautiful photo and video galleries in just a few clicks so that they can showcase and sell their work.