When I use the following code on a single blog site it works but if fails on a multi site that uses the domain mapping plugin. This code is in a plugin that is called by a short code.

global $current_user; get_currentuserinfo(); $user = wp_get_current_user();

$current_user is empty. Any ideas?

Update: I found a similar question here that said the init had to run first. I did test for this condition and the init had run before this code is called.

1 Answer 1


I got it to work by first checking if the user was logged in using: is_user_logged_in().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.