Home › Forums › General Issues › Querying with meta query on true/false field › Reply To: Querying with meta query on true/false field
This is how I got it to work, but it seems there should be an easier way?
$event_query = new WP_Query(
array(
'post_type' => 'al_event',
'orderby' => 'menu_order',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'event_date_end',
'compare' => '>=',
'value' => $today,
),
array(
'key' => 'event_date',
'compare' => '<=',
'value' => $future,
),
array(
'relation' => 'OR',
array(
'key' => 'hide_on_public_page',
'value' => '0'
),
array(
'key' => 'hide_on_public_page',
'compare' => 'NOT EXISTS',
)
)
),
) );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.