$args = array(
\'meta_query\' => array(
\'relation\' => \'OR\', //default AND
array(
\'key\' => \'feature\',
\'compare\' => \'NOT EXISTS\'
),
array(
\'key\' => \'feature\',
\'value\' => \'_wp_zero_value\',
\'compare\' => \'=\'
)
));
$the_query = new WP_Query($args);
var_dump($the_query);
进一步阅读:
Wordpress Doc注:在wordpress 3.9之前bug 这就是解决方法
array(
\'key\' => \'feature\',
\'compare\' => \'NOT EXISTS\',
\'value\' => \'\' //add this empty value check for check NOT EXISTS
),