Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_user_by [ WordPress Function ]

get_user_by ( $field, $value )
Parameters:
  • (string) $field The field to retrieve the user with. id | slug | email | login
  • (int|string) $value A value for $field. A user ID, slug, email address, or login name.
Returns:
  • (bool|object) False on failure, WP_User object on success
Defined at:



Retrieve user info by a given field

Source


<?php
function get_user_by$field$value ) {
    
$userdata WP_User::get_data_by$field$value );

    if ( !
$userdata )
        return 
false;

    
$user = new WP_User;
    
$user->init$userdata );

    return 
$user;
}
?>

Examples [ wp-snippets.com ]

Top Google Search Results

More ...

0 User Note(s)

None yet. Be the first!

Add New ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics