你需要的是
创建符合您搜索条件的用户列表
$user_query = get_users( [
\'fields\' => \'ID\',
\'meta_key\' => \'gender\',
\'meta_value\' => \'male\',
]);
echo \'<pre>\'; print_r($user_query); echo \'</pre>\';
创建自定义帖子类型的自定义查询,并在其中指定作者字段:
$my_custom_query = new WP_Query([
\'author__in\' => $user_query,
\'post_type\' => \'custom_post_type\',
\'meta_query\' => [
[
\'key\' => \'size\',
\'value\' => \'big\',
\'compare\' => \'LIKE\',
]
],
]);
应该是这样的