I have following code:
$posts = get_posts(array(
"meta_key" => "special",
"meta_value" => "surprise",
// "has_post_thumbnail" => true, // how to do that?
));
What should I do to select posts having post thumbnails?
I have following code:
$posts = get_posts(array(
"meta_key" => "special",
"meta_value" => "surprise",
// "has_post_thumbnail" => true, // how to do that?
));
What should I do to select posts having post thumbnails?
You must be logged in to post a comment.
The thumbnail is stored as a meta with a key of
_thumbnail_id
, so that could be used to find posts that have thumbnails. Something like this: