You have an example here: https://codex.wordpress.org/Class_Reference/WP_User_Query#Custom_Field_Parameters
Problem with your query is that you use wrong keys. It should be:
$args = array (
'meta_query' => array(
'relation' => 'AND',
array(
'key' => $campaign_type,
'value' => $Campaign_ID,
'compare' => '='
),
array(
'key' => 'organisation',
'value' => $userOrg,
'compare' => '='
)
));
Longer versions (meta_key
, meta_value
, meta_compare
) are used, when you don’t use meta_query
but put them directly in the query.
Related Posts:
- WP_User_Query to exclude users with no posts
- WP_User_Query will not combine meta + normal search methods
- WP_User_Query users by registered date
- User appears twice in a WP_User_Query
- Want to add my custom prepare query but add_filter doesn’t run
- each_connected in wp_user_query with Scribu’s Posts to Posts Plugin – Alternative method? [closed]
- Sort WP_User_Query by meta_key value with pre_user_query
- WP_User_Query Custom Field meta_query with Date clause
- Ordering WP_User_Query results by the user IDs used in the include parameter
- Get users in query and limit user output to five in random order
- Echo the number of users using WP_User_Query?
- Query Users by login, meta & role
- Basic Wp_user_query not finding any users
- Modify user table search results
- WP_User_Query not displaying any user [closed]
- Is it necessary to escape LIKE term in WP_User_Query?
- Exclude Users of a Certain Role in the Users Page
- Save users last visited blogs within whole network
- Snippett for create field in registration for users
- WordPress WP_User_Query($args) using Where and Like
- WP_User_Query unexpected output after upgrading toWordPress 4.0.1
- WP_User_Query Filter Results
- custom post type ‘pre_[cpt]_query’ hook
- Can you return users of a higher role than the current user using get_users()?
- unable to modify user table search results based on meta key
- Problem with WP_User_Query when ‘meta_value’ is an array
- Wp_user_query search by meta_key not returning any results
- WP_User_Query is Not Displaying Results
- how to get list of all users and their metadata
- How to search for (partial match) display names of WordPress users?
- Query users by custom taxonomy and user role
- Single loop for wp_query and wp_user_query
- How to search display_name column when using WP_User_Query
- Getting all user metadata from user
- WP User Query with search columns and meta query
- Wp_User_Query not sorting by meta key
- pre_user_query meta_query admin user list
- What is the most efficient way to search users by their display name?
- WP_User_Query with meta_query array relation ‘OR’
- How to get a list of all users registered before a given date?
- Pagination not working on custom query
- WP_User_Query order by meta_key that is an array
- User Relationship
- WP_User_Query search with multiple search queries
- How to customize user search
- WordPress User getting added with id of 0
- WP User Query get all authors with last name starting with specific letter
- WP_User_Query unable to retreive all user at once
- Complex WP_User_Query call fails on production server
- WP_User_Query ignoring ‘meta_query’ arguments
- Showing all users who match 2 meta fields with current user
- Parent User and Child User – relate users
- Four columns in the wp_users table
- User Query sort on custom field then name
- Why get_users() not working on the admin backend?
- What’s the proper way to add users to my site in order to test things?
- Two queries for a WP_User_Query search work perfectly apart, but not together
- WP User Query Issues
- Conditional IF statement not returning true even though echo of $user->province is correct
- List Users alphabetically with heading
- How to combine two get_users() array?
- is_user_logged_in() throwing undefined function error
- How can I prevent certain custom roles from seeing other custom roles on the user list page?
- Reduce number of SQL queries inside WP_Query loop to fetch author data
- last_name + first_name orderby with meta_query [solved]
- Dokan Marketplace store link in single product page
- WP_User_Query and user posts
- construct complex queries with WP User Query
- How do I sort a WP_USER_QUERY by multiple meta fields?
- WP_User_Query with more than two custom meta values
- Listing wordpress users with a search function
- Combining two meta_values within one row with query
- User with same Mail but a different additional info(like domain)
- Replace wp_query with wp_user_query
- Getting current user data with MySQL statement
- Issue with user meta_query
- Get a Post Loop based on Logged in User information into a Shortcode
- How to filter and/or sort user taxonomy query inside custom user taxonomy archive page?
- Query users and count totals based on meta values
- Random users always showing same 8 users
- Display the list of user’s comments + the post title + date
- SQL to set Display Name to First Name + Last Name
- Cannot update newly added User field using wp_update_user
- I imported an restore an database and It shows #1067 – Invalid default value for ‘user_registered’
- How to do WP_User_Query for Nested Array value Inside Nested Array field
- wp_get_current_user return ID = 0 when used outside of wordpress, such as webhook / fulfillment dialogflow
- WP_User_Query Search Multiple Keywords from a Multi-Select Field?
- How to query 5 users in random who have published more than 10 posts
- Periodically Query an external API on wordpress site
- WP User Query with meta queries
- Loop 1 user randomly
- How to order custom user list columns by datetime?
- Extend WP_User_Query or WP_User to return all custom fields?
- Search Functionality broken by the wp 4.2 update
- How can I include user meta information in the resulting array of a WP_User_Query?
- Paginate Links not working
- Sort users by custom user meta value
- Create Mashable Follow-like Facebook, Twitter login/connect?
- User Query Multiple Orderby Clause
- wp_user_query with meta_value_num for leaderboard