假设您试图拉取的“用户”是自定义的帖子类型。您可以使用“tax\\u query”,如下所示。
$user_args = array(
\'post_type\' => \'custom_user_post\', // Custom post type,
\'posts_per_page\' => 10,
\'paged\' => ( ! empty( get_query_var( \'paged\' ) )? get_query_var(\'paged\'): 1 ),
\'tax_query\' => array(
\'relation\' => \'AND\',
array(
\'taxonomy\' => \'user_sports\', //assuming your custom taxonomy is \'user_sport\'
\'field\' => \'slug\',
\'terms\' => array( \'football\' )
),
array(
\'taxonomy\' => \'user_sports\', //assuming your custom taxonomy is \'user_sport\'
\'field\' => \'slug\',
\'terms\' => array( \'basketball\' )
)
)
);
$users_list = new WP_Query( $user_args );