query.get_user_by

/ Database / query.get_user_by

Title : query.get_user_by
Purpose : It Returns one single row as an array. Use when you are expecting the output to be 1 element.
Syntax :
Input Parameters :
  • field:
    • (string) (Required) The field to retrieve the user with. id | ID | slug | email | login.
  • value:
    • (int|string) (Required) A value for field. A user ID, slug, email address, or login name.
Return Value : It returns: WP_User object on success, false on failure
Example 1 :
Code :
Output :
Description : The above example code will output the user object in array as shown above. It has some useful key eg. the data key also hold array in its value which has key value like ID, name, email, etc.
Categories
Most Popular

Leave a Reply

Your email address will not be published. Required fields are marked *