How to create a wordpress admin user using ftp


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 with your desired value.

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

TRENDING NOW:  Look the samsung's glamorous Android flip phone

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