如果我的逻辑是这样的,可以向用户展示,最好给出说明
使用者
I have two users with usermeta:
user A have usermeta country with value "USA" and univ with value "UCLA"
user B ONLY have usermeta country with value "USA"
发布
I also have two posts:
post 1 contain postmeta country with value "USA"
post 2 ONLY have postmeta country with value "USA" and state with value "TX"
逻辑
IF post have postmeta "COUNTRY" => "USA":
ECHO user A & user B
IF post have postmeta "COUNTRY" => "USA" AND have postmeta "UNIV" => "UCLA"
ONLY ECHO user A
因此,在第1篇文章中显示所有用户A&;但在帖子2中只显示用户A,因为用户A有状态。
到目前为止我的代码
get_users(array(
\'orderby\' => \'display_name\',
\'order\' => \'asc\',
\'meta_query\' => array(
\'relation\' => \'OR\', // Optional, defaults to "AND"
array(
\'key\' => \'verifier_assign_country\',
\'value\' => $countryCode,
\'compare\' => \'=\'
),
array(
\'relation\' => \'AND\',
array(
\'key\' => \'verifier_assign_univ\',
\'value\' => $univCode,
\'compare\' => \'LIKE\'
)
)
)
), \'objects\');
谢谢你的帮助