Current Logged in WP user
-
Is there a way to get the current WordPress logged in user if I wanted to build a stand-alone PHP page outside of WordPress.. I tried this code, but it doesn’t work:
<?php require_once('/var/www/html/myblog/wp-includes/pluggable.php'); global $current_user; get_currentuserinfo(); echo 'Username: ' . $current_user->user_login . "\n"; echo 'User email: ' . $current_user->user_email . "\n"; echo 'User level: ' . $current_user->user_level . "\n"; echo 'User first name: ' . $current_user->user_firstname . "\n"; echo 'User last name: ' . $current_user->user_lastname . "\n"; echo 'User display name: ' . $current_user->display_name . "\n"; echo 'User ID: ' . $current_user->ID . "\n"; ?>Thanks in advance!
MS
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Current Logged in WP user’ is closed to new replies.