Home › Forums › ACF PRO › True/False – No Value for False › Reply To: True/False – No Value for False
Hey,
This not work for the NULL case.
You can use var_dump(get_field( 'exclude_post' ));
to test.
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => -1,
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'exclude_post',
'value' => '0',
'compare' => '='
),
array(
'key' => 'exclude_post',
'compare' => 'NOT EXISTS'
)
)
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) :
while ( $query->have_posts() ) :
$query->the_post();
the_title();
endwhile;
wp_reset_postdata();
endif; ?>
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.