Advertisement
vapvarun

upgrade role for multisite for site admin

Jul 8th, 2016 (edited)
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2. * Paste this code in functions.php of your child theme.
  3. * And visit yourdomain.com/wp-admin once. Doesn't matter if you are logged-in or not.
  4. * Then remove this code!!!
  5. * Go to network-admin > users and check the super-admin tab
  6. */
  7. add_action( 'admin_init', 'bboss_make_user_superadmin' );
  8. function bboss_make_user_superadmin(){
  9.     //@todo: replace this with the real username
  10.     $username = 'andre';
  11.    
  12.     $user = get_user_by( 'login', $username );
  13.     if( !empty( $user ) ){
  14.         if( is_multisite() ){
  15.             grant_super_admin( $user->ID );
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement