Skip to content

Instantly share code, notes, and snippets.

@danichim
Created March 1, 2017 20:06
Show Gist options
  • Save danichim/636917eb44bc534a8bb05c033bf86be0 to your computer and use it in GitHub Desktop.
Save danichim/636917eb44bc534a8bb05c033bf86be0 to your computer and use it in GitHub Desktop.
#Create a new user account via FTP:
1. Open FTP client and connect to your account
2. Navigate to wp-content/themes
3. Open the folder of the theme you are using
4. Search for functions.php file and edit it
5. Copy and paste the following function:
function admin_account(){
$user = 'Username';
$pass = 'Password';
$email = 'email@domain.com';
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');
6. Change username, password and email to something unique
7. Save changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment