A less happy scenario is to us We forget the password the user with the rank of “admin” of the blog created with WordPress, in We no longer have access to the email address that would help us Resetam Parola, and that the situation is even more complicated, it would be his We have no access to the database either. MySQL.
In this scenario, the only option by which we can resume the rights of administrator on the blog, is his Cream a new user with administrator rank on WordPress. With this new user we will create we can reset our user's password or use it with all the 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 be able to edit them. To do this we need FTP access data. User FTP, word affect and IP-ul / the server address Ftp. A FTP customer to connect. Filezilla. FREE and easy to use.
After we connect to the FTP we go to edit the file functions.php. It can be found in: WP-Content/Themes/Theme-Current/.
We add in functions.php, 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 $ user data, $ pass and $ email, replacing “Username”, “Password” and “[email protected]” of the above code. After adding this function, save the changes and access the blog authentication page. /wp-admin /or /wp-login.php by default.
After you authenticate with the new data, do not forget to return to the Functions.php file from which to eliminate the code added above.
The newly created user will remain saved in the database.
