Created
May 3, 2018 11:31
-
-
Save mrfoxtalbot/f77218570435b1786833173927d59402 to your computer and use it in GitHub Desktop.
Generate a new WordPress user via FTP
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 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