WP_User_Query with 2 sets of conditions ‘AND’

Question

I would like to write some arguments for my query and both need to be true. I am having trouble with the Syntax.

‘meta_key’ => $campaign_type,

‘meta_value’ => $Campaign_ID,

AND

‘meta_key’ => ‘organisation’,

‘meta_value’ => $userOrg,

Below is my query code:

$args = array (
'meta_query' => array(
'relation' => 'AND',
    array(
        'meta_key' => $campaign_type, 
        'meta_value' => $Campaign_ID,
        'compare' => '='
    ),
    array(
        'meta_key' => 'organisation',
        'meta_value' => $userOrg,
        'compare' => '='
    )
)); 

Thank you.

0
proteuscanvas 8 months 2020-12-14T02:10:33-05:00 0 Answers 11 views 0

Leave an answer

Browse
Browse