I have a script running on the same server as my WP installation, and the user is logged in via WP.
I wish to check if the user is logged in, to prevent my script running for non logged in users, and access various user data.
When I try and access the data using:
wp_get_current_user()
I get an object with no user data.
My code looks like this
require('wp-blog-header.php');
$user = wp_get_current_user();
echo var_dump($user);
I expect the current logged in users data to be displayed.
Why is this the case.
I have tried using wp-login.php for the include, and I am sure I am logged in.