Showing posts with label How to get currently loggedin user details in Wordpress. Show all posts
Showing posts with label How to get currently loggedin user details in Wordpress. Show all posts

Saturday, 26 May 2012

How to get currently loggedin user details in Wordpress

You can use the following code snippet to get currently loggedin user details

<?php
    wp_get_current_user();
    /**
     * @example Safe usage: $current_user = wp_get_current_user();
     * if ( !($current_user instanceof WP_User) )
     *     return;
     */
    echo 'Username: ' . $current_user->user_login . '<br />';
    echo 'User email: ' . $current_user->user_email . '<br />';
    echo 'User level: ' . $current_user->user_level . '<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 />';
    echo 'User ID: ' . $current_user->ID . '<br />';
?>

For further, please reply this post  ....... Have fun  !!!!!