How to locate featured image URL in WordPress database tables?

I’m trying to find where WordPress stores the featured image URLs in the database. I’ve been looking through the wp_postmeta table but I’m having trouble identifying the correct post_id entries and the actual image URLs.

I checked the meta keys but I’m not sure which ones contain the featured image data. The database structure seems more complex than I expected. I need to extract these image links for a custom query I’m building.

Can someone walk me through the exact database fields and relationships? Which tables should I be looking at and what are the specific column names that store this information?

To find the featured image URL in WordPress, you start by querying the wp_postmeta table for the meta_key _thumbnail_id, which will provide you with the attachment ID corresponding to your post. With that ID, head over to the wp_posts table and look for entries where the post_type is ‘attachment’. This will give you the details of the image itself. Finally, make another query to the wp_postmeta table using the attachment ID and meta_key _wp_attached_file to retrieve the relative file path of the image. Combine this file path with your site’s uploads URL to get the full featured image URL.

to find the featured image URL, start with the wp_postmeta table for _thumbnail_id - that gives you the attachment ID. then go to wp_posts where ID matches that. the guid col has your image url. it’s kinda tricky, but that’s the way to do it!

WordPress stores featured images as attachment IDs, not direct URLs. Check the wp_postmeta table for _thumbnail_id - that’s your featured image ID. Then hit the wp_posts table where post_type = ‘attachment’ to grab the attachment record. The actual file path lives in wp_postmeta under _wp_attached_file. Just combine that path with your uploads directory and you’ve got your full URL. I’ve done this for custom exports before - the chain goes: Post → _thumbnail_id → Attachment Post → _wp_attached_file.