WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have added a column called post_thumbnail to my wp_posts table.

Is there any way I can make post_thumbnail to each post's featured image?

share|improve this question
Why you had to add a custom column to the default posts table? – Chittaranjan Dec 18 '13 at 18:47
Because I am running a script that turns an RSS feed into WP posts and I don't know how else to transfer the RSS thumbnail as a featured image. – Giveny Dec 18 '13 at 18:54
Take a look at this plugin WP RSS Multi Importer – Chittaranjan Dec 18 '13 at 19:01
There is more to my import script, that I need to keep. There should be a way to change where the featured image is found. Why is it basically impossible to find an answer to this anywhere? – Giveny Dec 18 '13 at 19:39
up vote 1 down vote accepted

How is the post_thumbnail information stored?

If you've already created an attachment with the image and are storing the attachment's postId in post_thumbnail, then you just need to go through your posts and update the meta using update_post_meta($postId, '_thubmnail_id', $attachmentPostId).

If post_thumbnail stores the path to an image file on your server, you need to create an attachment using wp_insert_attachment and pass in that file location. If the files are not already stored in the uploads directory, you can use the Add From Server plugin to import the files into wordpress as attachments. You can then use update_post_meta to set the attachment as your featured image.

If post_thumbnail stories the URI of the image, you need to save it to your server, then create the attachment, then update the post's meta.

share|improve this answer
Hey! Thanks for your answer. Does this mean that it is not possible to use images that are not stored in the wordpress blog? The post_thumbnail is just the url of an image on an external source. Also, I'd like it to be automated, so I don't have to import anything continuously. – Giveny Dec 18 '13 at 22:52
If you're trying to use Wordpress' Featured Image feature, the image needs to be stored by your blog. If you just want to display the image whenever the post is viewed, you can do modify the loop of the template that displays the post (ie. index.php, single.php, single-posttype.php depending on how much you've modified Wordpress) and put the url of the image inside of an <img> tag. – pLiKT Dec 19 '13 at 3:30
Thanks! How would I go about displaying the image to the relevant row? What code would I have to insert to post.php? I guess if I can do this there should be a plugin that transforms that image to the featured image? – Giveny Dec 20 '13 at 22:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.