0

please if possible help me, how i can get all users and meta keys via mysql query? i need in page display id, usename, email and metakey (user_work, user_street, user_state) for each users. Please explain me how it possible

Thanks

0

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 :)

Your Answer

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