WordPress: Bulk-delete featured images

After switching to a different theme, I wanted to bulk-delete all featured images. On wpbeginner, I found the following snippet, which worked like a charm. Simply add it to your functions.php, refresh your site and then remove the snippet again.


global $wpdb;
$wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_thumbnail_id'" );

Leave a Reply

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