WordPress – query to dump all posts with featured image

Sometimes we need to dump all post with featured images along with post title and image title. Here is mysql query which lists all posts with featured images. This may be useful for review purpose.

select p1.post_title, p2.post_title from wp_postmeta 
join wp_posts p1 on p1.ID = wp_postmeta.post_id
join wp_posts p2 on p2.ID = wp_postmeta.meta_value
where meta_key='_thumbnail_id'
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments