Title: query only post-thumbnail
Last modified: August 19, 2016

---

# query only post-thumbnail

 *  Resolved [fgiancarlo100](https://wordpress.org/support/users/fgiancarlo100/)
 * (@fgiancarlo100)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/query-just-post-thumbnail/)
 * I want to just be able to just query posts that have a post-thumbnail(featured
   image).
    I haven’t been able to find anything online and everything I have found
   points to mysql code. So I was wondering if there is a way to do i just with 
   php.
 * i had something in mind like
    `post__in' => get_option('the_post_thumbnail');`

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/query-just-post-thumbnail/#post-1941181)
 * it might be:
 *     ```
       'meta_key' => '_thumbnail_id'
       ```
   
 * [http://wordpress.org/support/topic/display-the-post-only-if-thumbnail-is-set-up?replies=17](http://wordpress.org/support/topic/display-the-post-only-if-thumbnail-is-set-up?replies=17)
 *  Thread Starter [fgiancarlo100](https://wordpress.org/support/users/fgiancarlo100/)
 * (@fgiancarlo100)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/query-just-post-thumbnail/#post-1941225)
 * Thank you for the help I think that worked, since the post without the thumbnail
   is not appearing. Also for the link which led me to this [http://codex.wordpress.org/Function_Reference/query_posts#Custom_Field_Parameter](http://codex.wordpress.org/Function_Reference/query_posts#Custom_Field_Parameter).
   It explains how the ‘meta_key’ can include only stuff that equals the value of
   that parameter.
 * Note: I have belief that this is a shorthand only available for version 3.1 of
   wordpress.
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/query-just-post-thumbnail/#post-1941232)
 * glad it worked 😉
 * if this is sorted, please mark the thread as ‘resolved’

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘query only post-thumbnail’ is closed to new replies.

## Tags

 * [featured image](https://wordpress.org/support/topic-tag/featured-image/)
 * [query](https://wordpress.org/support/topic-tag/query/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/query-just-post-thumbnail/#post-1941232)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
