我正在尝试检索meta_key状态等于正确或错误的所有帖子。目前我已创建下面的php变量,但它显示所有帖子也发布meta_key不等于正确或错误的帖子。我做错了什么?
$args = array(
'numberposts' => -1,
'post_status' => 'publish',
'cat' => '4,5,6',
'meta_query' => array(
array(
'meta_key' => 'status',
'meta_value' => 'wrong'
),
array(
'meta_key' => 'status',
'meta_value' => 'correct'
)
)
);
$the_query = new WP_Query( $args );
答案 0 :(得分:0)
试试这个:
$args = array(
'numberposts' => -1,
'post_status' => 'publish',
'cat' => '4,5,6',
'meta_query' => array(
array(
'meta_key' => 'status',
'meta_value' => array('wrong','correct')
'compare' => 'IN'
)
)
);