最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Update old Post image metadata to 'thumbnail' wp_attached_file

programmeradmin2浏览0评论

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!

发布评论

评论列表(0)

  1. 暂无评论