WordPress is a very database centric Content Management System, and like most systems the SQL database can be the best way to achieve a quick solution to an otherwise long and boring repetitive task. Here’s one of those tasks. I needed remove all the old thumbnails, due to bad sizing and thumbnail improvements. However I have over 100 posts, so I’ll be damned if I’m going to manually go through the WP dashboard and do it. Here’s a quick and easy way to kill all the thumbnails quickly via SQL
DELETE FROM wp_postmeta WHERE meta_key = '_thumbnail_id'
This will remove all thumbnail references on all posts and has_post_thumbnail() will return false.
If you needed to run this on a specific set of rows, you’d need to use an AND clause at the end of the above SQL
Note: Always run SQL commands like this on a testing server/localhost installation and have backups ready!
As I promised, im now going to share with you the new post thumbnail script that James’ Blog is using, this is the first WordPress tutorial ever posted on James’ Blog and officially starts the new WordPress tutorial category! In this tutorial you’ll be learning how to combine PHP and metadata to create unqiue post thumbnails which can be defined in the Manage post section of WP-Admin