0

I have variable $var which is dynamic. I want to find if there are any matches of this variable in custom user meta - "authmeta" and return the user_id of the corresponding entry if any matches are found.

  • Where and when do want to find this? – alpipego Aug 10 '15 at 7:04
  • $var is a custom query variable and i want to find if it matches to any user meta of a user and if so i want to get the user id. – Shahrukh Khan Aug 10 '15 at 7:11
0

You can use WP user query.

Assuming that your meta_key is authmeta you can use the following code to find the users with meta key authmeta and value of your $var variable.

$user_query = new WP_User_Query( array( 'meta_key' => 'authmeta', 'meta_value' => $var ) );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.