0

I added posts from other CMS to my new word press site. For featured images I changed, wp_post table as

post ID: 2300

Attachment in "wp_post":

ID:3400
post_type: attachment
post_mime_type: images/jpeg
post_parent: 2300
post_title: file name
post_name: fileName-in-WP-Content-upload
post_status:inherit
guid: site.com/upload/oldImages/fileName-in-WP-Content-upload.jpg

Making Featured image in "wp_postmeta"

post_id:2300
meta_key: _thmubnail_id
meta_value: 3400

Now I am not seeing featured image in post however I can see the image url with

echo wp_get_attachment_url( get_post_thumbnail_id(3400) );
2
  • How are you (or theme) calling featured image in post? What output exactly are you getting?
    – Rarst
    May 31, 2014 at 13:34
  • @Rarst I have my default theme, when I add feature image via admin panel it shows in feature image section when we edit post from admin panel, But as I have made the image featured from database & uploaded manually via ftp client it is not displaying in the featured image section, but yes I can get its url May 31, 2014 at 15:15

1 Answer 1

0

You're trying to display the post thumbnail for the attachment itself:

wp_get_attachment_url( get_post_thumbnail_id( 3400 ) )

Instead, use:

wp_get_attachment_url( get_post_thumbnail_id( 2300 ) )
3
  • No that was not my question, What I am asking is, in default we see an image in admin panel while editing a post in the featured image section, but as I have added the image by database & uploaded it via ftp client, this image is not showing in the featured image section but yes I can get the image's url with get_post_thumbnail_id() May 31, 2014 at 15:12
  • It's all in the ID - you're trying to get the featured image of the featured image! Use the ID of the post you're setting the featured image for. May 31, 2014 at 15:28
  • No, I mistyped here about ID, I am asking here is, I cannot see this custome made featured image in admin panel however if I upload an image from admin panel I see it there May 31, 2014 at 15:30

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.

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