Skip to content

Instantly share code, notes, and snippets.

@rohmann
Created October 25, 2013 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rohmann/7159907 to your computer and use it in GitHub Desktop.
Save rohmann/7159907 to your computer and use it in GitHub Desktop.
Tool to esaclate an admin to super admin in WordPress
<?php
/*
Plugin Name: Escalate to Super Admin
Plugin URI: https://gist.github.com/rohmann/7159907
Description: Tool to convert normal admin to super admin.
Place in mu-plugins folder. Then visit /wp-admin with a normal admin account. Next, go to the network dashboard to test it. Finally, delete this plugin to prevent abuse
Author: Alexander Rohmann
Author URI: https://gist.github.com/rohmann
Version: 1.0
*/
require_once(ABSPATH . 'wp-admin/includes/ms.php');
add_action('admin_init','escalate_to_super_admin');
function escalate_to_super_admin(){
if(current_user_can('manage_options') && !is_super_admin(get_current_user_id()))
grant_super_admin(get_current_user_id());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment