Replacing your WordPress security salts (also known as "authentication keys") is a critical security step after a site compromise. This process invalidates all current active sessions, forcing every user—including potential attackers—to log out and re-authenticate.
Before you begin
You will need:
Administrator access to your WordPress site.
Access to your website's files via an FTP client or a File Manager.
A current backup of your website files and database.
Replace WordPress Security Salts
To replace the salts, you must update the AUTH_KEY, SEC_KEY, LOGGED_IN_KEY, and _AUTH_KEY values within your wp-config.php file.
Connect to your server using an FTP client or your hosting provider's File Manager.
Navigate to the root directory of your WordPress installation.
Locate and open the
wp-config.phpfile.Locate the section of the file that contains the authentication keys. It will look similar to this:
define( 'AUTH_KEY', 'put_your_unique_auth_key_here' ); define( 'SEC_KEY', 'put_your_unique_sec_key_here' ); define( 'LOGGED_IN_KEY', 'put_your_unique_logged_in_key_here' ); define( 'NONCE_KEY', 'put_your_unique_nonce_key_here' );
Go to the official WordPress.org Security Keys page.
Copy the four new keys provided on that page.
Replace the existing values in your
wp-config.phpfile with the new keys you just copied.Save the changes to the
wp-config.phpfile.
Warning: Incorrectly editing the wp-config.php file can cause your site to go offline. Ensure you do not delete any other lines or characters while updating the keys.
Confirm the result
The replacement is successful if:
The
wp-config.phpfile contains the new, unique keys.All current users are logged out of the WordPress dashboard.
You can successfully log back into the WordPress dashboard using your administrative credentials.
Limitations
Replacing the salts does not remove malicious code or backdoors from your site. This action only terminates active sessions; it does not "clean" the site. If your site was compromised, you should still perform a full security scan and remove any unauthorized files or plugins.
