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) );
  • How are you (or theme) calling featured image in post? What output exactly are you getting? – Rarst May 31 '14 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 – Muhammad Arslan Jamshaid May 31 '14 at 15:15
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 ) )
  • 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() – Muhammad Arslan Jamshaid May 31 '14 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. – TheDeadMedic May 31 '14 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 – Muhammad Arslan Jamshaid May 31 '14 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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