I’ve added a true/false field on some custom post types that already exist. I would now like to query posts based on whether the field is false OR if the field doesn’t exist. This way, I don’t have to go back in and re-save all of the old posts that were created BEFORE I created the true/false field.
However, I cannot get this to work. Here’s my code:
'meta_query' => array(
'relation' => 'OR',
array(
'meta_key' => 'management',
'meta_compare' => 'NOT EXISTS'
),
array(
'meta_key' => 'management',
'meta_value' => false,
'meta_compare' => '=',
),
),
Use 1
and 0
… should work.