WP_User_Query
searches the $wpdb->users
table. It will not join on your custom table. How would it know what to JOIN
? The possible tables names and structures are practically infinite.
I believe you might be able to use a filter on pre_user_query
to insert your own values in the WHERE
clause but there is no JOIN
value so you will have to alter query_from
and query_where
. It could be tricky but should be do-able.
Edit:
Given new information, it now sounds like what you need is a meta_query
.
$args = array(
'count_total' => true,
'fields' => 'all_with_meta',
'meta_query' => array(
array(
'key' => 'user_business',
'value' => 'Clark',
'compare' => '='
)
)
);
$user_query = new WP_User_Query( $args );
That assumes that your user meta key is user_business
and that you want an exact match. See the Codex for other values for compare
.