How To Bulk Remove Featured Images From Posts in WordPress

By WP Saviour •  Updated: 08/11/20 •  2 min read

Recently definitely one in every of our readers requested us how they may bulk take away featured pictures from posts in WordPress? At WPSaviour, now we’ve got talked about featured pictures (submit thumbnails) many events. We confirmed you straightforward strategies so as to add featured images in WordPress, straightforward strategies so as to add new image sizes in WordPress, straightforward strategies to regenerate thumbnails, we even confirmed you straightforward strategies so as to add multiple featured images to a submit in WordPress. On this text we’ll current you straightforward strategies to bulk take away featured pictures from posts in WordPress.

The Disadvantage With Bulk Eradicating of Publish Thumbnails or Featured Images

Sadly, by default you might solely take away featured pictures by modifying each submit and eradicating the featured image. Now if a shopper has an entire lot of posts with featured pictures, then eradicating them one after the opposite is often a really time consuming job. Instead, we’ll try a particular methodology. We’ll run a database query and unset the featured pictures on all posts.

Sooner than you proceed, please discover that the code below will take away featured pictures from all posts in your WordPress website by merely merely pasting. Moreover discover that this code will not be going to delete any of your uploaded pictures, they’re going to nonetheless be obtainable in Media Library and you will reuse them anytime.

All it is important to do is copy and paste this code in your theme’s capabilities.php file.

1

2

3

4

5

worldwide $wpdb;

$wpdb->query( "

    DELETE FROM $wpdb->postmeta

    WHERE meta_key = '_thumbnail_id'

" );

That’s all. As rapidly as you save your capabilities.php file this script will run a database query and take away featured pictures from all posts.

Important: Please take away this code immediately after saving your capabilities.php file. You will not be capable to set featured pictures in WordPress as this code will preserve eradicating featured pictures from posts.

gp-5456382 as-6629138

WP Saviour

I am a WordPress specialist. My mission is to help you create beautiful websites with ease!