I have searched to the end of the internet and can’t seem to find anything that helps me with my issue. I have a wordpress site (inherited) and I simply want to be able to obtain a user’s information when they’re logged in. From the documentation I see to use get_currentuserinfo() but when I try to use it I get nothing.
The file resides in a folder in my main html directory. Here are the contents:
<?php
include_once("../wp-includes/pluggable.php");
global $current_user;
get_currentuserinfo();
echo $current_user->user_login;
?>
I’m literally losing my mind over this. Is there something else I need to include at the top? Do I have to create the page within wordpress?
you must include
wp-load.php
to use wordpress function in php file outside wordpress