Skip to main content

How to Replace WordPress Security Salts After a Compromise

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...

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.

  1. Connect to your server using an FTP client or your hosting provider's File Manager.

  2. Navigate to the root directory of your WordPress installation.

  3. Locate and open the wp-config.php file.

  4. 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' );

  5. Copy the four new keys provided on that page.

  6. Replace the existing values in your wp-config.php file with the new keys you just copied.

  7. Save the changes to the wp-config.php file.

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.php file 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.

Did this answer your question?