@misthero or @gothickmatt , is there an SQL query to bulk delete all “attachments” from posts. I have to many posts, it will take ages to do one by one
@asialove Your solution worked perfectly!! But i already deleted a lot of images in my folder, so now the featured images shows up as not found, do you know any query to bulk remove all attachments from posts? so i can generate them from scratch.
There’s no way I’m editing WordPress core files for something that looks like it can be solved by changing one line in the plugin 🙂
oomskaap, did you try the solution in my last post?
oomskaap, do not edit your database,, just leave it there,
upload the images by ftp again to the folders..
@asianlove yes i did, and it worked perfectly. But unforunately before i tried it, i deleted all the generated thumbnails in my upload folder. So the old featured images are still “stuck” in there with a not found logo. Which means i have to click “remove feautured image” on all my post. But i have over 1000. Any bulk way to do it once ?
oomskaap, u need an sql-query smth like this:
DELETE FROM wp_postmeta WHERE meta_key = '_thumbnail_id';
but I didn’t test it and do not take any responsibility for any troubles, you understand…
Auto update old posts without deleting after you applied my previous fix or the gothickmatt one you can use this modded version.
http://www.mediafire.com/?1g701s5stxgivy7
do a backup of your database just in case
1. upload to plugin folder
2. disable auto-post-thumbnail or auto featured images
3. enable this
4. go to the option page and press the red button
5. wait.
6. wait and do not refresh the page, depending on the number of posts it can be very slow, in my case it took 20 minutes for 4567 posts.
this will process all your post and regenate working thumbnails only for videos. be careful it will generate a thumbnail even if it already exists, this is why it works, it will update the broken thumbnails, be patinent, the process is slow.
When finished DISABLE this modded version and reenable your version.
have fun!
try this to check if the “feature image” value is still stored in your database
SELECT * FROM wp_postmeta
WHERE meta_value
like ‘%jpg%’and meta_key
=’_wp_attachment_metadata’
There’s no way I’m editing WordPress core files for something that looks like it can be solved by changing one line in the plugin
Good for you!
People: Never, ever, edit core WordPress files.
@asialove: Please stop advising people to edit core. If there’s an issue with the plugin, fix it, Don’t change core.
@danstudio , worked like a charm! thanks to everyone in this thread. My site is up and working again with thumbnails restored.
oomskaap, great!
I’ve came to this solution just an hour ago while reading about SQL queries )) Just wanted to clear thumbnail cache. I’m happy my investigation wasn’t useless ))
I went with misthero’s suggestion and added
update_attached_file( $thumb_id, $new_file );
to auto-post-thumbnail.php as I too didn’t want to mess with core files. I then used another plug-in to removed all featured images from old posts, then re-generate thumbnails using the Auto Post Thumbnails plugin. Everything is back to normal now.
Thank you misthero! 🙂
where i will put this code plzz??????
DELETE FROM wp_postmeta WHERE meta_key = ‘_thumbnail_id’;