Pagina 1 din 1

Reset Wordpress password hack using ftp

MesajScris: 16 Mai 2023 21:26
de DeeJay
If you forgot the wordpress login credentials, or admin account name and password, you can create a new user with administrator privileges using only ftp access to the site files:

1) login using ftp to your site
2) navigate to wp-content/themes/(active theme)
3) open functions.php
4) after first <?PHP in functions.php add this lines:
Cod: Selectaţi tot
function wpb_admin_account(){
$user = 'myadminuser'; //or whatever username you want
$pass = 'Password'; //or whatever password you want
$email = 'myemail@emailsite.xyz'; //an email address
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');

5) save the file and open yourwordpresssite.xyz , then navigate to yourwordpresssite.xyz/wp-login.php and login with the user and password you created in step 4)
6) if you have access then edit your user and change the password
7) delete the lines of code you entered in functions.php at step 4) and save the functions.php file
8) enjoy