Custom field and category query

For multiple category handling you need either category__in or a tax_query, for multiple custom fields you use meta_query. The various options for both of these are covered in the WP_Query codex page. $args = array( ‘posts_per_page’ => 10, ‘category__in’ => array( 163, 165 ), ‘meta_query’ => array( array( ‘key’ => ‘a_field’, ‘value’ => array( 1, … Read more

Filter query based on date in custom field

You can use this format of meta_query, although you’d have to change the format of all of your existing expiry-date entries. ‘meta_query’ => array( ‘key’ => ‘expiry-date’, ‘value’ => array($today, $UserInputExpiry), ‘compare’ => ‘BETWEEN’, ‘type’ => ‘DATE’ ) The second date in the array is the later date and both $today and $UserInputExpiry should be … Read more