Add a Super Admin to a WordPressMU via database

Recently I was on a website for a client that was not able to give me access as a Super Admin on their WordPress network. Here is a quick post on how to add a user as a Super Admin with phpMyAdmin or using WordPress functions.

What is WordPress Multisite?

Some people call this WordPress Multisite but if you’re unfamiliar with multisite/networks they allow you to manage multiple WordPress blogs on a single server / database.

For those who don’t know a WordPress Super Admin account gets to use the network admin page which is useful for managing blogs, plugins, and themes across all websites that run on the installation.

I’ve included three methods to add a Super Admin to WordPress, using the network admin, phpMyAdmin, or even adding a script to your functions.php.

Using the Network Admin to Add a Super Admin

If you’re already logged in as a super admin you should be able to simply activate users as super admins by navigating to their profile page. The setting should say “Grant this user super admin privileges for the Network.” and be below the user’s username.

Using Sequal Pro or phpMyAdmin to add a Super Admin

There is only one field you’ll need to edit to add a Super Admin, and that is “admins” in the “wp_sitemeta” table. You’ll see some serialized data in the value of the field such as “a:1:{i:1;s:5:”admin”;}”. When you’re dealing with serialized data it can get a bit odd, but adding an admin with the user name “Client” would be done as follows:

"a:2:{i:1;s:5:"admin";i:2;s:4:"Andy";}"

So as you can see the first number a:2 matches how many entries you have so for 3 admins you’d put 3. I simple just copied and pasted the first bit “i:1;s:5:”admin”” and added a semicolon to indicate another entry. Then increased the i by one and s matches how many characters are in the username, in my case 4. If you enter any of the variables wrong you’ll know by checking to see if your new user is an admin.

Using your Theme’s Functions.php to add Super Admins

To add an admin by user ID you can use "grant_super_admin".

Simply put the grant_super_admin function in your theme’s functions.php file (usually in /wp-content/themes/YOUR THEME FOLDER/functions.php). You’ll need to put the ID of the user as a variable, the example below we’re using the user ID of 1:

grant_super_admin(1);

After doing this check to confirm that user has Super Admin privileges and remove it from functions.php so it doesn’t constantly run.