Combine query in WP_User_Query() – WordPress Development Stack Exchange
Question
I am new user of WP_User_Query(). I don’t know how to express whole situation. If I use below code I am getting good result.
$users = new WP_User_Query(array(
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'last_name',
'value' => $_POST['search'],
'compare' => 'LIKE',
),
)
));
If I use below code I am getting good result also.
$users = new WP_User_Query(array(
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'organisation',
'value' => 519,
'compare' => 'LIKE',
),
)
));
I am trying to combine these two query like below.
$users = new WP_User_Query(array(
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'last_name',
'value' => $_POST['search'],
'compare' => 'LIKE',
),
array(
'key' => 'organisation',
'value' => 519,
'compare' => 'LIKE',
),
)
));
But I am not getting expected output.
How can I combine these two queries ?
0
2 years
2022-01-16T05:30:06-05:00
2022-01-16T05:30:06-05:00 0 Answers
0 views
0
Leave an answer