I am updating a very old WP-based website that was created prior to WP use of "featured images" aka thumbnails and the name of all post images are contained in a custom meta-field called "Image" (rather than embedded in the body of the post). The old Theme then called the path plus the meta-field to display the image.

However with the new Theme I'd like to move all of those images from the old custom field to the "featured image" instead so that the NEW Theme doesn't have to treat old and new content differently or test for the presence of a name in that meta-field before deciding how to display the post image.

Is there a MySQL query that will find all of the meta-data with a key of "Image" and then copy that data (value) to a new record for each Post ID where featured images are stored in the wp_postmeta table as _wp_attached_file?

OR would that not be advisable given that all other attachment data (_wp_attachment_metadata and _wp_attachment_alt) would be missing? All that is stored now is the image file name.

I'm not good with SQL queries so any help and advice would be much appreciated!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.