How to Query Posts by Custom Field in WordPress (meta_query)
Query posts by custom field with meta_query Custom fields are often used for things you later want to filter by: the city of an event, its date, a “featured” flag. WP_Query can filter by them with the meta_query argument, from a simple equality check to ranges and several conditions combined with AND/OR.
Details