How to create a wordpress admin user using ftp

wordpress

If you forget your wordpress username or password and you can’t change the database but you have the FTP access, then this is an effective method to follow.

Go to your page source code and see which theme you are using. Navigate to the theme folder in FTP and open the function.php file. Add the bellow code bottom of the page.

Note: Change the user name, password and email@yourwebsite.com with your desired value.

function wpb_admin_account(){
$user = ‘username’;
$pass = ‘password’;
$email = ’email@yourwebsite.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’);

TRENDING NOW:  Record ODI score ENG vs AUS - Twitter reaction

About Sandeep Pattanaik

Apart from eating Pakhala(ପଖାଳ), the source of my affinity for all things digital solutions. I believe that anyone can write code that a computer can understand, but only good programmers write code that humans can understand. I'm a troll hunter.

View all posts by Sandeep Pattanaik →

Leave a Reply