How to Add a Super Admin to a WordPress Network (3 Methods)

Recently I was stuck with phpMyAdmin access but no WordPress Super Admin access in a WordPress network install.

Here is a quick post on how to add a user as a Super Admin with phpMyAdmin or using WordPress functions.

For those who don’t know the WordPress Super Admin in a network install gets to use the network admin page which is useful for managing blogs, plugins, and themes.

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. Read more about setting up a WordPress Network here.

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 in the users pane.

The setting should say “Grant this user super admin privileges for the Network.” and be below the user’s username.

Grant Super Admin option in the WordPress Network Admin
Grant Super Admin option in the WordPress Network Admin

Using 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 “Andy” 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/CURRENT THEME NAME/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 with each page load.


And just like that you’ve added a new super admin to your WordPress network!

11 thoughts on “How to Add a Super Admin to a WordPress Network (3 Methods)”

  1. Great summary and helped me out of the rabbit hole of spending the week in phpmyadmin trying to figuring out by trial and error. What was missing was the record in wp_sitemeta. Thank you!

    Reply
  2. WOW! Thank you so much. It is an art to make something really complex so easy to do. I got mine fixed at first attempt. You are really a genuis.

    Reply
  3. This article helped me a lot! The clear example and step-by-step how to change the user in the database made me do it right in 1 time. Thanks!

    Reply
  4. Lifesaver!! Specifically, I used the database/phpmyadmin approach. In my case, I needed to change my superadmin username for security (it was not admin, but it was being guessed by hackers too often). I used the “Username Changer” plugin, but lost superadmin access. Used your instructions to change my old username in the db. At first it “didn’t work” — but that’s because I neglected to change the number of characters in the serialized data. Thanks for detailing how to work this out!

    Reply
  5. Running WP 4.5.3, this solution didn’t work. (The site didn’t seem to accept grant_super_admin() as a function)
    It’s possible from the user edit page, but be sure you open that from the network admin, not the site admin

    Reply

Leave a Comment