我正试图让所有这些用户都有候选人的角色和以下3项技能。skill a, skill x, skill e
. 只需要三个用户,我错过了什么
$args = array(
\'role\' => \'candidate\',
\'meta_query\' => array(
\'relation\' => \'AND\',
array(
\'key\' => \'as_skills\',
\'value\' => array(\'skilla\',\'skillx\',\'skille\'),
\'compare\' => \'=\'
),
),
);
$test = get_users($args);
echo "<pre>";
print_r($test);
echo "</pre>";
没有数据,但数据确实存在。
SO网友:Malay Solanki
有一个小问题。您必须使用\'IN\'
而不是=
因为要使用数组检查值
$args = array(
\'role\' => \'candidate\',
\'meta_query\' => array(
\'relation\' => \'AND\',
array(
\'key\' => \'as_skills\',
\'value\' => array(\'skilla\',\'skillx\',\'skille\'),
\'compare\' => \'IN\'
),
),
);
$test = get_users($args);
echo "<pre>";
print_r($test);
echo "</pre>";