Create WordPress Admin Account Using FTP/PHP

Here is a little snippet which can create a WordPress backend account with ease using the FTP, just paste this PHP snippet in the active theme’s functions.php and the account will be created. Also, make sure the username and the email are unique, or the function will fail.

Select Code
function admin_account(){
$user = 'AccountID';
$pass = 'AccountPassword';
$email = '[email protected]';
if ( !username_exists( $user )  && !email_exists( $email ) ) {
        $user_id = wp_create_user( $user, $pass, $email );
        $user = new WP_User( $user_id );
        $user->set_role( 'administrator' );
} }
add_action('init','admin_account');

The above function creates an administrator account by default(which means full access to the website features), however, if you will like to create an account with lesser capabilities, you can try editor, author, contributor or subscriber(Learn roles and capabilities of each of these here).

3,104 thoughts on “Create WordPress Admin Account Using FTP/PHP

  1. Pingback: miami escorts
  2. Pingback: questtour.org

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>