I am developing an wp plugin and I am trying to get the current user.
If i return with an error print_r($current_user) returns the needed info.
But the plugin is activated without an error it returns NULL.
I tried to include some wp core files such as wp-load etc but this doesn't have any effect.
this is my code(without the error):
class My_plugin_class{
var $user;
function __construct()
{
global $current_user;
//Set the current user
$this->user = $current_user;
print_r($this->user);
}
}
EDIT: Just edited my code to:
require_once(ABSPATH . '/wp-includes/pluggable.php');
global $current_user;
get_currentuserinfo();
The function get_currentuserinfo() does now a print_r(); and isn't going to stop?
EDIT: Fixed it myself.
