How can we add a user with a WordPress Administrator rank using FTP

A less fortunate script is to us Forget the password user with the rank of "admin”Of the blog created with WordPress, to We no longer have access to the email address That would help us Reset password, And that the situation would be even more complicated, it would be We have no access to the database either. MySQL.

In this scenario, the only way we can resume blog administrator rights is to create a new user with a WordPress Administrator rank. With this new user we will create we can reset our user's password or we can use it with all administration rights.

How can we add a user "admin" on WordPress, with the help of FTP access

All we need is to We have access to the site's files and we can edit them. To do this we need to FTP access data. User FTP, password Afferent and IPSite / server address FTP. An FTP client to connect to. FileZilla. Free and easy to use.

After we connect to FTP, we're going to edit the file functions.php. It can be found in: wp-content / themes /theme-current/.

Adding in functions.php the code:
function wpb_admin_account(){
$user = 'Username';
$pass = 'Password';
$email = '[email protected]';
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');

Edit with your data $ user, $ pass and $ email, replacing "Username", "Password" and "[email protected]" in the code above. After adding this feature, save the changes and access the blog login page. / wp-admin / or /wp-login.php by default.

After logging in with the new data, do not forget to go back to the functions.php file to remove the code added above.

The newly created user will be saved in the database.

How can we add a user with a WordPress Administrator rank using FTP

About the author

Stealth

Passionate about everything gadget and IT, I write with pleasure on stealthsettings.com since 2006 and I like to discover with you new things about computers and operating systems macOS, Linux, Windows, iOS and Android.

Leave a Comment