How are roles stored in the database?
I know roles are defined http://codex.wordpress.org/Roles_and_Capabilities but how are they stored in the database? For instance, how is "Super Admin" stored i.e. 'super_admin'?
I know roles are defined http://codex.wordpress.org/Roles_and_Capabilities but how are they stored in the database? For instance, how is "Super Admin" stored i.e. 'super_admin'?
Answers 1
The core functions:
is_super_admin()
,grant_super_admin()
,revoke_super_admin()
fetch the super admins data from the
wp_sitemeta
table with:It's stored as a serialized array of user logins, for each site, like:
It's possible to override it with the global
$site_admins
array.On the other hand, the general user roles (admin, editor, author, ...) are stored as serialized arrays, for each user, like:
in the
wp_usermeta
table under thewp_capabilities
meta key and/or thewp_{$blog_id}_capabilities
meta keys.Note that the
wp_
prefix might be different on your install.