How can we add a user with a rank of Administrator on 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 on WordPress. 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 an "admin" user 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 = 'email@domeniu.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 with your data $ user, $ pass and $ email, replacing "Username", "Password” and “email@domeniu.com” from the code above. After adding this function, save the changes and access the blog's 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.

Passionate about technology, I enjoy writing on StealthSettings.com since 2006. I have a rich experience in operating systems: macOS, Windows, and Linux, as well as in programming languages and blogging platforms (WordPress) and for online stores (WooCommerce, Magento, PrestaShop).

How to » Internet » How can we add a user with a rank of Administrator on WordPress, using FTP
Leave a Comment