Change WordPress password, the first method
<?php
$your_user_login = "Your WordPress login account";
$your_user_pass = "The hash result generated by the current WordPress password generator";
include __DIR__ . "/wp-load.php";
global $wpdb;
if( $wpdb->update($wpdb->prefix . "users",["user_pass" => $your_user_pass],["user_login" => $your_user_login]) )
{
echo "Change wordpress password successfully!";
exit();
}
echo "Failed to modify wordpress password!";
exit();
?>
- 1. Create a wordpress-database-password.php file in the root directory of the website;
- 2. Copy the above code snippet and paste it into the file, and save the file;
- 3. Modify Your WordPress login account;
- 4. Open the webpage in the browser, for example: your domain name/wordpress-database-password.php; when prompted Change wordpress password successfully! Congratulations, you have successfully reset your WordPress password;
- 5. Important: After successfully resetting the WordPress password, delete the wordpress-database-password.php file to avoid illegal use;