The following query returns false if the key is not set. Given I am trying to add the feature and would prefer not to have to change every post, this seems odd. Is there a way to change this behaviour? It would seem logical that a query that looks for posts with a meta key not equal to something would include posts without that meta key altogether.
'meta_query' => array(
array(
'key' => 'hidden',
'value' => '1',
'compare' => '!='
)
)
);
https://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters, add a query for “NOT EXISTS”
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'hidden',
'value' => '1',
'compare' => '!='
),
array(
'key' => 'hidden',
'compare' => 'NOT EXISTS'
)
);
);