Fix missing media info and thumbnails in WordPress 3.4.x
Does your WordPress media library look like this photo? Maybe you don’t have the same affinity for the BMW 1M that I do, but if you’re missing thumbnails, I might be able to help.
After upgrading an important installation to WordPress 3.4, I suddenly noticed that many thumbnails had disappeared, specifically the earlier uploads. After posting to WP support forum and WP StackExchange group and receiving minimal response, I decided to take a look at the database myself.
I ended up finding the problem in the wp_postmeta table. It turns out that prior versions of WordPress didn’t insert the _wp_attached_file meta key when uploading a photo, and the latest version requires it. Since this key doesn’t exist for some uploads, the system defaults to showing the media icon, and refuses to display resized images in other posts.
The solution is to run through the list of attachments and insert this meta key where it doesn’t exist. I wrote code to do so, and it worked for me, but when another user requested it in a more useable format, I wrapped it in a basic WordPress plugin.
I can’t provide much in the way of support for it, but if it fixes your problem, leave a comment.