Home › Forums › ACF PRO › True/False – No Value for False › Reply To: True/False – No Value for False
I know I’m bit late for the party but I think this might be useful to someone. The return value change based on the method you use.
If you use get_posts() then it will return null for false values. If you use WP_Query() you’ll get true if checked and false if not checked.
So here is what worked for me. for get_posts()
'meta_query' => array(
array(
'key' => 'archived_post',
'value' => '1',
'compare' => 'NOT EXISTS'
),)
For WP_Query()
'meta_query' => array(
array(
'key' => 'archived_post',
'value' => '1',
'compare' => '!='
),)
Cheers
Amila
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.