outputing | wp_get_current_user() | to a json
-
when I use this:
<?php $current_user = wp_get_current_user(); /** * @example Safe usage: * $current_user = wp_get_current_user(); * if ( ! $current_user->exists() ) { * return; * } */ 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 />'; echo 'User ID: ' . $current_user->ID . '<br />'; ?>
it gives me a “PHP Fatal error: Uncaught Error: Call to undefined function wp_get_current_user() in /home/gary/public_html/test.php:2”
I’m going to try on a fresh KUSANAGI instance, the error happens on my fairly modified centOS 7.
Will post results.
The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘outputing | wp_get_current_user() | to a json’ is closed to new replies.