Hello,
I am trying to sort out user based on custom taxonomy term value.
My custom taxonomy field is cloneable.
These are the codes:
$meta_boxes[] = array(
'title' => 'Foreign University Info',
'type' => 'user', // THIS: Specifically for user
'fields' => array(
array(
'id' => "{$prefix}content_foreign_uni_option",
'type' => 'group',
'clone' => true,
'group_title' => 'Foreign University No.{#}',
'save_state' => true,
'collapsible' => true,
'add_button' => 'Add Another University',
'fields' => array(
array(
'name' => 'University',
'id' => "{$prefix}funiversity",
'type' => 'taxonomy_advanced',
'options' => array(
'taxonomy' => 'Foreign_Uni',
'type' => 'select_advanced',
'args' => array()
),
'placeholder' => 'Select a Foreign University',
'multiple' => false,
),
),
),
),
);
I am using the codes below to sort out the user:
$uni_name = $_POST[ 'uni_name' ]; ?>="X University"
<?php $category = get_term_by('name', $uni_name, 'Foreign_Uni'); ?>
<?php $funiversity_name = $category->name; ?>
Suppose $funiversity_name="X University"
So, I want to show all users who have "themepixels_funiversity" field value to "X University"
$blogusers =get_users(
array( 'role__in' => array( 'subscriber' ),
'meta_query' => array(
'key' => 'themepixels_funiversity',
'value' => $funiversity_name,
),
'fields' => 'all',
)
); ?>
<?php var_dump($blogusers); ?>
But it shows all the user (Subscriber).
Could you please help me to resolve this?
Thanks