Created
November 9, 2013 16:08
-
-
Save nickdavis/7386926 to your computer and use it in GitHub Desktop.
Use with extreme caution only. Place the code (after <?php) in your active theme's functions.php file and then load one page on the website. Afterwards delete code from functions.php immediately, login with your new admin username and password and then change your password immediately.
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
<?php | |
/* | |
* Create New Admin Account in WordPress via FTP | |
* @link: http://stephanis.info/2011/08/11/create-new-admin-account-in-wordpress-via-ftp/ | |
* | |
*/ | |
function add_admin_acct(){ | |
$login = 'myacct1'; | |
$passw = 'mypass1'; | |
$email = '[email protected]'; | |
if ( !username_exists( $login ) && !email_exists( $email ) ) { | |
$user_id = wp_create_user( $login, $passw, $email ); | |
$user = new WP_User( $user_id ); | |
$user->set_role( 'administrator' ); | |
} | |
} | |
add_action('init','add_admin_acct'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment