0

I want to adapt my old custom website database (composed of only one table) to Wordpress database.

All data has been correctly imported in both tables (wp_posts and wp_postmeta) with a php code that I can share if needed.

Here is a screenshot of my wp_posts table...wp_posts screenshot

...and a screenshot of my wp_postmeta table (I imported only one entry to facilitate understanding). wp_postmeta screenshot

As you can see, wp_posts/post_parent column of id 2 (referring to the featured image) is well linked to id 1 (which is the post).

But in my wordpress admin panel, I still have no linked featured image.blank featured image

Is there another place where the image and the post have to be linked?

  • Make sure that image exists at address mentioned in guid column. Give it a try and see what happens. – Qaisar Feroz Feb 22 at 17:10
  • Yes, it exists. When I access to the URL in guid, I can see the image. And it is correctly imported in the Media library. – supershivas Feb 22 at 17:14
  • OK, there should be a record in the wp_postmeta table which registers the thumbnail ID against the post_id with meta_key = '_thumbnail_id' . Does this record exists for your post? – Qaisar Feroz Feb 22 at 17:31
  • you can check if a thumbnail exist by $featured image_id = get_post_meta( $post_id, '_thumbnail_id', true ); – Qaisar Feroz Feb 22 at 17:36
  • When I set a featured image regularly (with the button in the admin panel), I didn't have any '_thumbnail_id' entry. The thumbnail doest exist as I can see it in the Media Library. – supershivas Feb 22 at 17:39

Your Answer

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

Browse other questions tagged or ask your own question.