I recently needed to re-do my image thumbnails inside all WordPress posts.
I decided to use phpMyAdmin to run a SQL query to list all posts with thumbnails, then individually update each post from the WordPress admin.
Here’s the SQL query I used in phpMyAdmin:
SELECT * FROM `wp_posts` WHERE ( `post_content` REGEXP '([0-9]+x[0-9]+).(gif|jpeg|bmp|jpg|png)' AND `post_type` = "post" )
How to find WordPress posts with thumbnails
- Log into the cPanel for your website. The address is usually www.website.com/cpanel, and the username and password would have been provided by your host when you first joined.
- Under ‘Databases’ click on the icon for ‘phpMyAdmin’ – this is the tool they provide to manage the databases linked to your hosting service.
- Using the left hand manu, click on the ‘wp_posts’ table
- Click on the ‘Inline’ link and enter the following query
`post_content` REGEXP '([0-9]+x[0-9]+).(gif|jpeg|bmp|jpg|png)'
AND `post_type` = "post"
- Click ‘Go’ to run the query
- The results returned will be each post that has a thumbnail in the content.
- For each result, take the ID number and enter into the WordPress admin edit URL.
- For example, https://www.website.com/wp-admin/post.php?post=1602&action=edit
- Now you can edit the post, updating or removing each thumbnail.