#43577 closed defect (bug) (worksforme)
On multisite, fetch the current user via wp_get_current_user() returns empty roles array
Reported by: | bretweinraub | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Users | Keywords: | |
Focuses: | multisite | Cc: |
Description
$user = wp_get_current_user();
var_dump($user->{'roles'});
... prints
{}
Works fine in the root site, but in the subsite, roles is blank.
In the site console, all the role functionality works fine. All plugins are disabled, and I've confirmed that the roles array is blank in a simple page template.
Change History (2)
Note: See
TracTickets for help on using
tickets.
I've resolved the issue.
The user in question was a network "Super Admin". Thus, they had all site privileges, without actually having a site role as defined in the WP_User object returned from wp_get_current_user();