• Hello.

    I really need a place where is code about user ID. I mean that http://scr.hu/1htz/4smce

    I just want to know how can I get this variable or where is code in .php file. Would be awesome if you could give me a way how to get this variable or give me line and name of .php file.

    Regreds,
    Oskar.

Viewing 2 replies - 1 through 2 (of 2 total)
  • i Think you want current logged in user… here is the code you can get that easily

    <?php
        $current_user = wp_get_current_user();
    
    echo 'Username: ' . $current_user->user_login . '<br />';
    echo 'User email: ' . $current_user->user_email . '<br />';
    echo 'User first name: ' . $current_user->user_firstname . '<br />';
    echo 'User last name: ' . $current_user->user_lastname . '<br />';
    echo 'User display name: ' . $current_user->display_name . '<br />';
    
    //Here is the user id of the user above all other filds
    echo 'User ID: ' . $current_user->ID . '<br />';
    ?>
    Thread Starter oskarkxyz

    (@oskarkxyz)

    Sure, thanks! 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to get user ID variable?’ is closed to new replies.