When WordPress 2.9 came out, one of the touted features was the “official” support for post thumbnails. Instead of storing URLs in custom fields, a new method with an easy UI was added. This is great for one major reason: now your thumbnails are less reliant on your theme. If you change your theme, you don’t have to worry about editing it to use the same custom field as your previous theme. Plugins, also, can now easily retrieve post thumbnails, as they don’t have to guess at your custom field.
Unfortunately, this new feature raises a new problem. What if you already have an existing, custom field-based, thumbnail solution? How can you easily (and optimally) move from one to the other?
I have another blog running a plugin called Wordbooker. It automatically syndicates links to my posts on Facebook. It can include the posts’ thumbnails when it does so, but it relies on WP 2.9’s way of doing things. Facebook “fans” won’t see the nice images by the links unless I were to migrate from custom fields to the new built-in thumbnail feature. How do I do that?
I could update my template to use PHP “if” statements to determine which method it should use for each post, and just use the new thumbnails for new post. That seems a little clunky though. Another, cleaner, option would be to have a look at the SQL columns and build a query to create the new thumbnails.
This seems like a great opportunity for a plugin developer. A single-use “importer” that reads an inputted custom field and iterates through all of your posts, creating the new thumbnail entries.