Here we learn about how to resetting WordPress admin password through FTP.
Syntax:
<?php wp_set_password( string $password, int $user_id ); ?>
Parameters:
- $password – (string)(Required) Add string for new password.
- $user_id – (int)(Required) pass User ID
Custom code copied and paste into your child theme’s functions.php file.
<?php $user_id = 1; $password = 'HelloWorld'; wp_set_password( $password, $user_id ); ?>
Please follow the below steps.
Step 1: Custom code copied and paste into your child theme’s functions.php file.
Step 2: Page load you have got your admin password reset.
Step 3: After page load removed your code in your child theme’s functions.php file otherwise it will reset your password every page load.
Step 4: Now You Can access your admin login.
OUTPUT: