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 rank "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 create, we can reset our user's password or use it with all your administrative rights.

How can we add a user "admin" to 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@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');

Edit your $ username, $ pass and $ email, replacing "Username", "Password" and "email@domain.com" in the code above. Once you've added this feature, save the changes and visit 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 that means gadgets and IT, I write with pleasure stealthsettings.com from 2006 and I like to discover with you new things about computers and operating systems macOS, Linux, Windows, iOS and Android.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment is processed.