WP_Query Check if post has one or more attached medias
I’m afraid that it’s not possible by default. Using WP_Query you can only check if posts have a featured image set. What you can do instead: Create a hook that fires during post save (e.g. “post_updated”), check if this post has any attachments – save this information in post_meta. Use meta_query with WP_Query to get … Read more