Skip to content

Instantly share code, notes, and snippets.

@mrfoxtalbot
Created May 3, 2018 11:31
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 mrfoxtalbot/f77218570435b1786833173927d59402 to your computer and use it in GitHub Desktop.
Save mrfoxtalbot/f77218570435b1786833173927d59402 to your computer and use it in GitHub Desktop.
Generate a new WordPress user via FTP
<?php function wpb_admin_account(){
$user = 'your-username';
$pass = 'your-password';
$email = 'name@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','wpb_admin_account'); ?>
// Upload this snippet to your functions.php file (or /mu-plugins folder) To generate a new user via FTP
// Via http://www.wpbeginner.com/wp-tutorials/how-to-add-an-admin-user-in-wordpress-using-ftp/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment