Support » Networking WordPress » Recover super admin access after username change?

  • Hello! I am using wp 3 multi-site, and I changed my admin username in the MYSQL database. Only problem is, I now lost super admin access, and am finding no way to recover it. Any kind soul willing to enlighten me?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter revolutionfrance


    Any help to find?

    Thread Starter revolutionfrance


    No answer in 2 days…is there really no one that knows how to do this?

    I just had this same problem occur. Did you find a solution?

    I’ll move this to the multi-site forum, folk might know there.

    You’ll have to fix it in the database now. πŸ™‚

    Super Admin staus is kept track of separately. And you have to be logged in as a Super Admin to make another one, so. In your case, the only way to fix it now is in the db.

    look in the wp_sitemeta table for the site admins field. you’ll see a value like this:


    The 6 means my usenrame has 6 characters. andrea is my username. πŸ™‚ Change whatever you have to your new changed username and that integer.

    Thank you so much Andrea! This problem has kept me busy for the past three hours after changing my name “Ruben” to “Beheerder” (Dutch for Admin) using a search-and-replace in the SQL. Lost my Super Admin “powers” but couldn’t easily change things back since I already re-added “Ruben” as a regular user afterwards.

    Although I find this “number-of-characters-in-username” an ultimately stupid “feature” in WordPress, I thank you very very much for this simple solution. Couldn’t find a fix anywhere, only ended up here after searching Google xxx times.

    Perhaps you can tell why this “character count” is useful, just to satisfy my curiosity and hopefully find it less stupid?

    The contents of that wp_sitemeta record is a PHP array that has been serialized ( so that it can be stored in the database.

    For example, if you have 3 usernames that are allowed to be site admins, this is stored in a PHP array with 3 elements, which is serialized before being stored in the database.

    In other words, the command I listed above is a database thing, not a wordpress thing.

    I have also lost my super admin. I accidently dropped the database record for my administrator user, but I had backed it up and restored the database field to the identical setting.

    I still somehow lost my super admin. I double checked the wp_sitemeta table and my site admins says:

    a:1:{i:1;s:10:”administra”;} which matches up to my admin name.

    Any ideas about what else might be causing a problem?

    Never mind. I fixed it by adding a new identity into the database.

    I see a lot of threads about this, explaining how to edit the database records to fix this, but that didn’t work for me

    instead I just put this in a plugin and later removed it (4 is user id I want to make super admin)

    that alone caused some errors, I had to add other code to make it work, which still caused a different error but it had the desired effect and I could just delete all this when I was done (I’m just wondering if this is a symptom of other problems with my installation)

    require_once(ABSPATH . 'wp-includes/pluggable.php');
    function grant_super_admin( $user_id ) {
    	global $super_admins;
    	// If global super_admins override is defined, there is nothing to do here.
    	if ( isset($super_admins) )
    		return false;
    	do_action( 'grant_super_admin', $user_id );
    	// Directly fetch site_admins instead of using get_super_admins()
    	$super_admins = get_site_option( 'site_admins', array( 'admin' ) );
    	$user = new WP_User( $user_id );
    	if ( ! in_array( $user->user_login, $super_admins ) ) {
    		$super_admins[] = $user->user_login;
    		update_site_option( 'site_admins' , $super_admins );
    		do_action( 'granted_super_admin', $user_id );
    		return true;
    	return false;

    (I’m just wondering if this is a symptom of other problems with my installation)

    Probably, yes.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Recover super admin access after username change?’ is closed to new replies.