Is there a way to filter posts by featured image when initialising a WP_Query object?
$my_query = WP_Query(array("has_thumbnail"=>true));
or, more ideally
$my_query = WP_Query(array("has_thumbnail_size"=>"custom_size"));
Technically featured image is custom field with name
Size on other hand is attribute of that attachment and not post itself. You will need to loop through attachment and get sizes they have (if I remember right it should be in data returned by
Post thumbnails in WP are stored as meta-data. In /wp-includes/post-thumbnail-template.php, WP retrieves the post thumbnail ID by using the _thumbnail_id value, which can be used as a filter in your WP_Query. When used in this way, WP will check the retrieved posts to see if that meta_key value exists, and if so, it will include those posts in the query, excluding all others. Using the example provided, it would look something like this.