Hi,
I have created a group of post_types that is related to a custom field within a group. This group is related to the user’s registration, where it marks the checkbox to relate.
I’m trying to list the user according to the checkbox marked, except that returns nothing and when I remove the meta_query works but without the filter I want.
I await a solution.
Thank you for your attention,
Hugs!
$args = array (
'role' => 'contributor',
'relation' => 'and',
'meta_key' => 'produtos_comercializados',
'meta_value' => get_term_by('slug', $_GET['tag'], 'oportunidade-tag')->term_id,
'meta_compare' => '=',
'fields' => 'all',
);
$user_query = new WP_User_Query( $args );
if ( ! empty( $user_query->results ) ) {
foreach ( $user_query->results as $user ) {
echo '<li>' . $user->user_login . ' - '.$user->user_email.'</li>';
}
}
Hi @bigrecreio
Thanks for the code and screenshots, but I don’t understand how your code is possible to work.
You have created a post type, and a custom field which has tags. Is this correct?
This has no relation to a user, so I don’t think your args and the WP_User_Query object would work.
Perhaps you could re explain what you are trying to do.