Securing WordPress using Security Keys and Salts

Since WordPress 2.7, four security keys have been added to help make your WordPress site more secure. These security keys help encrypt the data that is stored in the cookies, which is data that helps WordPress identify your computer as one that is logged into your WordPress website as a certain user. If your WordPress cookies are ever obtained by someone with bad intentions, the encrypted cookie will make it much more difficult if not impossible for this individual to compromise your website using your cookies.

These security keys are stored in your wp-config.php file, which is in the root of your WordPress directory.You’ll want to ensure that they are setup properly.

Using the File Manager in your cPanel (or any other editor that you’re comfortable with), open the wp-config.php file. Look for text similar to:

 
/** * Authentication Unique Keys and Salts.  
    * 
    * Change these to different unique phrases! 
    * You can generate these using the  
    * {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}       
    * You can change these at any point in time to invalidate all existing cookies.  
    * This will force all users to have to log in again. 
    *  
    * @since 2.6.0  
*/ 

define('AUTH_KEY',         't`DK%X:>xy|e-Z(BXb/f(Ur`8#~UzUQG-^_Cs_GHs5U-&Wb?pgn^p8(2@}IcnCa|');
define('SECURE_AUTH_KEY',  'D&ovlU#|CvJ##uNq}bel+^MFtT&.b9{UvR]g%ixsXhGlRJ7q!h}XWdEC[BOKXssj');
define('LOGGED_IN_KEY',    'MGKi8Br(&{H*~&0s;{k0<S(O:+f#WM+q|npJ-+P;RDKT:~jrmgj#/-,[hOBk!ry^');
define('NONCE_KEY',        'FIsAsXJKL5ZlQo)iD-pt??eUbdc{_Cn<4!d~yqz))&B D?AwK%)+)F2aNwI|siOe');
define('AUTH_SALT',        '7T-!^i!0,w)L#JK@pc2{8XE[DenYI^BVf{L:jvF,hf}zBf883td6D;Vcy8,S)-&G');
define('SECURE_AUTH_SALT', 'I6`V|mDZq21-J|ihb u^q0F }F_NUcy`l,=obGtq*p#Ybe4a31R,r=|n#=]@]c #');
define('LOGGED_IN_SALT',   'w<$4c$Hmd%/*]`Oom>(hdXW|0M=X={we6;Mpvtg+V.o<$|#_}qG(GaVDEsn,~*4i');
define('NONCE_SALT',       'a|#h{c5|P &xWs4IZ20c2&%4!c(/uG}W:mAvy<I44`jAbup]t=]V<`}.py(wTP%%');

The text above is random, and will vary based on each WordPress installation. Do not copy this code!

You want to make sure that you see these lines that start with define(‘AUTH_KEY’, define(‘SECURE_AUTH_KEY’, and so on. If you don’t see these lines, you’ll want to set this up yourself.

Manual Set Up:

  1. Visit https://api.wordpress.org/secret-key/1.1/salt/
  2. Copy the randomly generated values into your wp-config.php file. That’s it! When you do this, you’re changing the way that WordPress encrypts cookie data. Do this in a sense “nulls and voids” all other cookies, so if you have current users logged in, they’ll need to login again.

More Information on Security Keys

If you’d like more information on WordPress Security Keys, WordPress.org recommends the following links:

4 thoughts on “Securing WordPress using Security Keys and Salts

  1. Im trying to configure some software that posts to wordpress.

    It is asking me for a Key and a Secret.

    Im assuming I can use the AUTH_KEY but not sure where to find the Secret.

    Any advice?

  2. i have two files.. one is config.php and the other one is config-sample.php. Please let me know which one to change.

    my website address is https://yourfinancebook.com/

    1. Hello Abhi,

      The file named config.php is the one you want to work with.

      Kindest Regards,
      Scott M

Was this article helpful? Join the conversation!

Server Madness Sale
Score Big with Savings up to 99% Off

X