{"id":6037241,"date":"2015-04-21T02:54:23","date_gmt":"2015-04-21T02:54:23","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/set-thumbnails-via-database\/"},"modified":"2016-08-24T14:59:36","modified_gmt":"2016-08-24T14:59:36","slug":"set-thumbnails-via-database","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/set-thumbnails-via-database\/","title":{"rendered":"Set Thumbnails via Database"},"content":{"rendered":"<p>So I have a ton of old posts that have images attached (via the Media Uploader) to the post content, but don&#8217;t have featured images. OF COURSE, my theme wants to use featured images. \ud83d\ude42<\/p>\n<p>I have the post_id of each post in my set. I have both the meta_id value of the image for each post and the URL of each image.<\/p>\n<p>I want to just do a SQL statement\/insert\/update in my database backend to set all the featured images, but I can&#8217;t seem to get it to work. I tried inserting the post_id, meta_key=&#8221;_thumbnail_id&#8221;, and meta_value=my image ID into the _postmeta table and &#8230; nothing. They don&#8217;t show up as attached on the front-end. Am I missing a step? Do I need to regenerate thumbnails or something afterward?<\/p>\n<p>Any insight is greatly appreciated, thanks!<\/p>\n<p>P.S. I know there have been solutions\/ideas posted elsewhere about how to accomplish this with php or wp hooks, etc. I just want to update from the database side if possible&#8230;SO much less confusing for me. \ud83d\ude42<\/p>\n","protected":false},"template":"","class_list":["post-6037241","topic","type-topic","status-closed","hentry","topic-tag-database","topic-tag-featured","topic-tag-featured-image","topic-tag-image","topic-tag-thumbnail"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/6037241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/6037241\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=6037241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}