How can we add a user with a rank of Administrator pe WordPress, 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 our rights administrator on the blog, is to create a new user with the rank of Administrator pe WordPress. With this new user we will create we can reset our user's password or we can use it with full rights adminstay

How to 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/.

We add in functions.php, the code:

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' );
} }

Edit with your data $ user, $ pass and $ email, replacing "Username", "Password”And“ ”from 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 to » Internet » How can we add a user with a rank of Administrator pe WordPress, using FTP

Passionate about technology, I like to test and write tutorials about operating systems macOS, Linux, Windows, about WordPress, WooCommerce and configure LEMP web servers (Linux, NGINX, MySQL and PHP). I write on since 2006, and a few years later I started writing on iHowTo.Tips tutorials and news about devices in the ecosystem Apple: iPhone, iPad, Apple Watch, HomePod, iMac, MacBook, AirPods and accessories.

Leave a Comment