New 24/7 monitoring and daily cloud backups now included in every Shield Pro plan.

Salts

How to change WordPress salts and security keys

Authentication keys and salts in wp-config.php sign cookies and sessions. Rotating them logs everyone out and invalidates stolen sessions after a breach. This tutorial shows how to generate and apply new keys without breaking your site.

Time: 10-20 minutes Level: Beginner

What this problem looks like

WordPress ships eight authentication constants in wp-config.php. They should be unique per site. After malware or credential leaks, rotating salts invalidates hijacked sessions even if attackers know old passwords.

Changing keys does not delete users or content. Everyone must log in again, including API integrations that rely on application passwords or cookie auth.

Step 1: Generate fresh keys

Open https://api.wordpress.org/secret-key/1.1/salt/ in your browser. Copy the entire block of define statements. Each refresh produces unique random strings.

Step 2: Edit wp-config.php via SFTP

Locate the section labelled Authentication Unique Keys and Salts. Replace all eight lines with the new block. Do not leave duplicate define statements.

php
define( 'AUTH_KEY',         'put your unique phrase here' );
define( 'SECURE_AUTH_KEY',  'put your unique phrase here' );
define( 'LOGGED_IN_KEY',    'put your unique phrase here' );
define( 'NONCE_KEY',        'put your unique phrase here' );
define( 'AUTH_SALT',        'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT',   'put your unique phrase here' );
define( 'NONCE_SALT',       'put your unique phrase here' );
Rotate salts only after you have removed malware and changed compromised passwords. New keys do not stop a backdoor file from re-infecting the site.

Step 3: Save and confirm the site loads

A syntax error in wp-config.php whitescreens the site. Save carefully and reload the homepage. You should see the site but be logged out of admin.

Step 4: Log in and review admin users

Go to Users → All Users. Delete unknown administrators. Force password resets for remaining admins. Check installed plugins for anything you did not add.

Step 5: Document the change for your team

Tell editors they must log in again. Reconnect integrations that used cookie-based auth. Application passwords in WordPress 5.6+ may need regeneration.

When to stop DIY and hire help

After a hack, rotating salts is one step in a full cleanup. BugShield removes malware, rotates credentials, and hardens wp-config at a fixed price through secure Vault access.

FAQs

How often should I rotate WordPress salts?

After suspected compromise or staff departures with admin access. Routine rotation every few months is optional for low-risk blogs.

Will changing salts break WooCommerce checkout?

Active customer carts may reset when sessions invalidate. Do this during low-traffic hours and announce maintenance if needed.

Can I change salts from wp-admin?

No. They live only in wp-config.php on the server. Use SFTP or hosting File Manager.

Do salts encrypt the database?

No. They sign cookies and security tokens. Database encryption is a separate hosting feature.

Rather someone else fixed it?

Request a fix at a confirmed price. Named UK developer, secure Vault, direct chat.

Request a Fix