Change Administrator to Super Administrator (multi-site)

There are multiple ways to do this. One would be to change the values in the database directly (explained here). However, this easily introduces errors, so I don’t prefer it.


The other method is to use grant_super_admin() with the user’s ID. The default admin’s ID is 1 and there are various methods to find other users’ ID’s.

Say the ID of the user you want to make a super admin is n. This code now needs to be run (at least) once. One of the easiest ways to make sure it will be is to download the functions.php of the active theme.

You could just add it to the top of the file and it will probably work. But it is safer to run code inside hooks. In the TwentySeventeen theme this could be the twentyseventeen_setup() method. Just add this line

grant_super_admin( n );

Now visit the site, and make sure it worked. Then you can safely remove this code again.

error code: 523