Get all data form users and users metakey

WordPress provides a function get_users which display all the user detail and which field you want just pass in the ‘fields’ array.


$users = get_users( array( 'fields' => array( 'ID','user_login', 'user_email') ) );

foreach ( $blogusers as $user ) {

    $user_work = get_user_meta( $user->ID, 'user_work', true);
    $user_street = get_user_meta( $user->ID, 'user_street', true);
    $user_state = get_user_meta( $user->ID, 'user_state', true);

    echo 'User ID : '.$user->ID.' Username : '.$user->user_login.' E-Mail : '.$user->user_email.' Work : '.$user_work.' Street'.$user_street.' and Stat is :'.$user_state;

}

Cheers 🙂