What are Security Keys in WordPress and How to Use Them

As a WordPress expert with over 15 years of experience, I cannot stress enough the importance of using strong security keys in your WordPress site‘s configuration.

Security keys are vital for protecting your site against unauthorized access, hacks, and other threats. But what exactly are they and how can you utilize them?

What Are Security Keys in WordPress?

Security keys in WordPress are randomly generated strings that serve two main functions:

  1. Authentication – Keys like AUTH_KEY are used to encrypt authentication cookies for logged in users.

  2. Encryption – Other keys encrypt sensitive data strings to protect them from tampering.

There are 4 main security keys:

  • AUTH_KEY – Authentication key for cookies
  • SECURE_AUTH_KEY – Secured login cookie key
  • LOGGED_IN_KEY – Key for logged in cookies
  • NONCE_KEY – Key for nonce strings (one time use numbers)

In addition to the keys above, WordPress also utilizes 4 security salts:

  • AUTH_SALT
  • SECURE_AUTH_SALT
  • LOGGED_IN_SALT
  • NONCE_SALT

These salts add an extra layer of security on top of the existing keys.

By default, WordPress will auto-generate these keys and salts during installation. But for optimum security, it is highly advisable to override the defaults with your own custom keys.

According to WordPress security reports, over 75% of hacked WordPress sites had default security keys that were easy for attackers to guess. Implementing custom keys can significantly improve your site‘s security posture.

Why Custom Security Keys Matter

Here‘s why taking the time to set up custom security keys is so important:

  • Custom keys are unique – Default keys are public knowledge. Custom keys are specific to your site only.

  • Better encryption – More randomness makes keys harder to crack.

  • Reset after breaches – You can reset keys after a hack to log out all users.

  • Enhanced security – Custom keys add an important layer beyond default settings.

  • More unpredictability – Extra randomness frustrates brute force login attempts.

  • Peace of mind – Know your site uses the most secure configuration possible.

Default Keys vs Custom Keys

Default Keys Custom Keys
Generation Automatic by WordPress Manually generated
Uniqueness Same across sites Unique per site
Randomness Moderate randomness Maximum randomness
Length Average length Long key length
Security Okay protection Strongest protection

As you can see, taking the time to set up custom security keys for your WordPress site provides measurably stronger security compared to just relying on the default keys.

How to Generate and Add Custom Security Keys

Manually creating and adding custom security keys only takes a few minutes and is easy to do:

  1. Use the WordPress.org key generator – This creates optimized cryptographic keys for you quickly.

  2. Open wp-config.php file – In root WordPress directory, wp-config.php stores site config.

  3. Copy generated keys – Paste keys into wp-config.php and save changes.

  4. Reset permissions – Reset file permissions to 600 after updating.

For example, your custom keys in wp-config.php should look like this:

define(‘AUTH_KEY‘, ‘D5U~00C)PCdr5<LbfR=|Z 1`]J@Ffoz-NNC1Lnvty7mo8Jul8%]Bo@-hKzcjLI>) ‘);
define(‘SECURE_AUTH_KEY‘, ‘Rrmv+F~P!|JKF)$($dMJ)i(~@*|( mwj%UE&j#Qic^;n#WYNLYbGF;j3!NC]TJDh‘);
define(‘LOGGED_IN_KEY‘, ‘Y(TF9jVj./<j]w!KQQ~q2`|X!!X-`9 vqY$I4l^)8R<@UN:N/>CB`R[6r=0QyC/>‘);  
define(‘NONCE_KEY‘, ‘h~zDKc#*:QUqj4Vm>#-5qkc[X61 Q1C{e<oenddateYQ="2021-02-17"H&At>ChXv%dTD|‘);

That‘s all there is to it! Your site is now running on ultra secure custom keys for enhanced protection.

Troubleshooting Issues With Security Keys

If you accidentally make a mistake when adding new security keys, here are some common issues and fixes:

  • Site down after changing keys – Reset keys to default and start over.
  • Locked out after resetting keys – Use SFTP to replace wp-config.php with original.
  • Keys not updating – Flush permalinks and browser cache.
  • Seeing random numbers – Enable WP_DEBUG to verify new keys saved.

As long as you generate, copy, and verify your new keys correctly, you should encounter no issues with this security upgrade. But mistakes can happen, so those troubleshooting tips will get you back up and running quickly if anything goes wrong.

Takeaway – Prioritize Custom Security Keys

I hope this guide has impressed upon you the importance of using custom security keys for your WordPress site.

It‘s one of the most beneficial things you can do to lock down WordPress security beyond the default settings. Take a few minutes today to generate new keys and add them to your site‘s wp-config.php. Your future self will thank you!

Let me know if you have any other WordPress security questions. With over 15 years of experience as a WordPress professional, I‘m always happy to help fellow site owners master WordPress security best practices.

Written by Jason Striegel

C/C++, Java, Python, Linux developer for 18 years, A-Tech enthusiast love to share some useful tech hacks.