meta\\u查询可以同时进行“和”检查和“或”。所以别担心。您的编码正确。这是实际格式。。。
$a = new WP_Query(
array(
\'fields\' => \'ids\',
\'ignore_sticky_posts\' => true,
\'meta_query\' => array(
\'relation\' => \'OR\',
array(
\'key\' => \'foo\',
\'value\' => array( \'foobar\' ),
\'compare\' => \'IN\'
),
array(
\'key\' => \'bar\',
\'value\' => array( \'foobar2\' ),
\'compare\' => \'IN\'
)
)
) );
print_r( $a->posts );
您应该尝试使用此编码。。。
$args=new WP_Query(
array(
\'post_type\' => \'post\',
\'posts_per_page\' => -1,
\'meta_query\' => array(
\'relation\' => \'OR\',
array(
\'key\' => \'app_os\',
\'value\' => array(\'iPhone\'),
\'compare\' => \'LIKE\',
),
array(
\'key\' => \'app_os_2\',
\'value\' => array(\'iPad\') ,
\'compare\' => \'LIKE\',
)
)
);
print_r($args->posts);