<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Devang Patel</title>
    <description>The latest articles on DEV Community by Devang Patel (@devang100).</description>
    <link>https://dev.to/devang100</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4249660%2F42141217-5447-44fa-8cfb-e5a9c39e80e8.jpg</url>
      <title>DEV Community: Devang Patel</title>
      <link>https://dev.to/devang100</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/devang100"/>
    <language>en</language>
    <item>
      <title>WordPress security hardening checklist: 20 steps that matter</title>
      <dc:creator>Devang Patel</dc:creator>
      <pubDate>Tue, 17 Nov 2026 11:09:46 +0000</pubDate>
      <link>https://dev.to/devang100/wordpress-security-hardening-checklist-20-steps-that-matter-1o0i</link>
      <guid>https://dev.to/devang100/wordpress-security-hardening-checklist-20-steps-that-matter-1o0i</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Most known WordPress vulnerabilities are in plugins and themes, not in WordPress itself, and stolen or guessed passwords are the other common way in. So start there: update everything, delete what you don't use, and put two-factor authentication and login limits on every admin account. Then lock down wp-config.php, file permissions and the server, keep backups somewhere else, and check for changed files.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://devangwp.com/blog/wordpress-security-hardening-checklist" rel="noopener noreferrer"&gt;devangwp.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I learned how sites break before I learned how to style them. A cyber-security internship came before most of my front-end work, and security audits and hardening have been part of my WordPress work ever since. This is the checklist I'd give any site owner, in order of impact: the first two sections deal with the most common ways in, and the rest make the damage small when something does get through.&lt;/p&gt;

&lt;p&gt;WordPress's own &lt;a href="https://developer.wordpress.org/advanced-administration/security/hardening/" rel="noopener noreferrer"&gt;hardening guide&lt;/a&gt; explains the background. This list is the practical order to do it in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before you start
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Take a full backup&lt;/strong&gt; of the files and the database, and make sure you know how to restore it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use a staging copy if you have one.&lt;/strong&gt; A few steps here (blocking XML-RPC, stopping PHP in uploads, a Content Security Policy) can break a plugin that relies on what you're switching off. Test there first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Some steps need server access&lt;/strong&gt; (an &lt;code&gt;.htaccess&lt;/code&gt; file on Apache, a config file on Nginx). If you're on managed hosting, your host can usually apply them for you.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Updates and what you install
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Keep WordPress, plugins and themes updated
&lt;/h3&gt;

&lt;p&gt;Most security releases fix flaws that have already been made public, so an out-of-date plugin is a documented way in that anyone can look up. Minor WordPress releases update automatically by default; leave that on. Turn on automatic updates for plugins you trust (from the Plugins screen), and test major updates on staging before they go live. Check for updates every week.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Delete plugins and themes you don't use
&lt;/h3&gt;

&lt;p&gt;A deactivated plugin's files are still on the server, and they can still be requested directly. Deactivating isn't removing: delete it. Keep one default theme (a recent Twenty-something theme) as a fallback, and delete every other theme you aren't using.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Install only from sources you trust
&lt;/h3&gt;

&lt;p&gt;Install from WordPress.org, or from the developer's own site for paid plugins. Never install "nulled" (pirated) premium plugins or themes: they're a common way to ship malware onto a site. Before installing anything, check when it was last updated and whether anyone still maintains it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Logins and users
&lt;/h2&gt;

&lt;h3&gt;
  
  
  4. Strong passwords and two-factor authentication for every admin
&lt;/h3&gt;

&lt;p&gt;Use a unique password from a password manager, plus two-factor authentication (an authenticator app) on every account that can publish content or change settings. WordPress doesn't include two-factor authentication itself, so it comes from a plugin (such as Two Factor, maintained by WordPress contributors) or from your single sign-on provider.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Limit login attempts
&lt;/h3&gt;

&lt;p&gt;Out of the box, WordPress lets anyone try passwords on &lt;code&gt;wp-login.php&lt;/code&gt; as often as they like. Limit failed attempts with a plugin, or better, rate-limit the login page at the server or the firewall so the guesses never reach PHP at all.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Give everyone the lowest role that does the job
&lt;/h3&gt;

&lt;p&gt;Editors don't need to be Administrators. Every few months, go through the users list: remove people who have left, downgrade anyone with more access than they use, and make sure no account is called "admin". Fewer administrator accounts means fewer passwords that can unlock everything.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Turn off XML-RPC if nothing uses it
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;xmlrpc.php&lt;/code&gt; is an older remote API. One of its methods, &lt;code&gt;system.multicall&lt;/code&gt;, lets an attacker try many passwords in a single request, which makes it a favourite target. The WordPress mobile app and Jetpack can use it, so check first. If nothing needs it, block it at the server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight apache"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Apache: .htaccess in the site root
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Files&lt;/span&gt; &lt;span class="n"&gt;xmlrpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;php&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nc"&gt;Require&lt;/span&gt; &lt;span class="n"&gt;all&lt;/span&gt; &lt;span class="n"&gt;denied&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Files&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Nginx: inside your server block
&lt;/span&gt;&lt;span class="na"&gt;location&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;xmlrpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;php&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;deny&lt;/span&gt; &lt;span class="n"&gt;all&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  wp-config.php and files
&lt;/h2&gt;

&lt;h3&gt;
  
  
  8. Turn off the dashboard file editor
&lt;/h3&gt;

&lt;p&gt;By default, any Administrator can edit theme and plugin PHP files from the dashboard. That turns one stolen admin password into code running on your server. Add this line to &lt;code&gt;wp-config.php&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;define&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'DISALLOW_FILE_EDIT'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  9. Use unique keys and salts
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;wp-config.php&lt;/code&gt; holds eight secret keys and salts that protect login cookies. Make sure they're long and unique to this site. You can generate a fresh set from the &lt;a href="https://api.wordpress.org/secret-key/1.1/salt/" rel="noopener noreferrer"&gt;official generator&lt;/a&gt;. Replacing them logs everyone out, which is exactly what you want after a suspected break-in.&lt;/p&gt;

&lt;h3&gt;
  
  
  10. Set file permissions correctly
&lt;/h3&gt;

&lt;p&gt;Directories should be 755 and files 644. &lt;code&gt;wp-config.php&lt;/code&gt; should be tighter: 640, or 440 or 400 if your host allows it. Nothing should ever be 777. Files should belong to your hosting account rather than the web server, except where WordPress has to write (usually &lt;code&gt;wp-content/uploads&lt;/code&gt;).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Run from the WordPress root folder. Check with your host first.&lt;/span&gt;
find . -type d -exec chmod 755 &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt; \&lt;span class="o"&gt;;&lt;/span&gt;
find . -type f -exec chmod 644 &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt; \&lt;span class="o"&gt;;&lt;/span&gt;
chmod 640 wp-config.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  11. Stop PHP from running in the uploads folder
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;wp-content/uploads&lt;/code&gt; should only ever hold media. If an attacker manages to upload a PHP file there (through a vulnerable form or plugin), blocking PHP in that folder stops the file from running.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight apache"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Apache: .htaccess inside wp-content/uploads
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;FilesMatch&lt;/span&gt; &lt;span class="s2"&gt;"\.(php|phar|phtml)$"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nc"&gt;Require&lt;/span&gt; &lt;span class="n"&gt;all&lt;/span&gt; &lt;span class="n"&gt;denied&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;FilesMatch&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Nginx: put this before your main PHP location block
&lt;/span&gt;&lt;span class="n"&gt;location&lt;/span&gt; &lt;span class="o"&gt;~*&lt;/span&gt; &lt;span class="o"&gt;^/&lt;/span&gt;&lt;span class="n"&gt;wp&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;uploads&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;\&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;php&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;phar&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;phtml&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;$ &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;deny&lt;/span&gt; &lt;span class="n"&gt;all&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  12. Keep errors off the page
&lt;/h3&gt;

&lt;p&gt;Error messages can reveal file paths and details about your database. On a live site, debug mode should be off:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Live site: no errors on the page&lt;/span&gt;
&lt;span class="nf"&gt;define&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'WP_DEBUG'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Only while debugging: log errors, never display them,&lt;/span&gt;
&lt;span class="c1"&gt;// and write the log outside the public web folder&lt;/span&gt;
&lt;span class="c1"&gt;// define( 'WP_DEBUG', true );&lt;/span&gt;
&lt;span class="c1"&gt;// define( 'WP_DEBUG_DISPLAY', false );&lt;/span&gt;
&lt;span class="c1"&gt;// define( 'WP_DEBUG_LOG', '/home/account/logs/wp-debug.log' );&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since WordPress 5.1, &lt;code&gt;WP_DEBUG_LOG&lt;/code&gt; accepts a file path. Use one: the default location, &lt;code&gt;wp-content/debug.log&lt;/code&gt;, can be downloaded by anyone who guesses the address.&lt;/p&gt;

&lt;h2&gt;
  
  
  Server and HTTPS
&lt;/h2&gt;

&lt;h3&gt;
  
  
  13. HTTPS everywhere, with HSTS
&lt;/h3&gt;

&lt;p&gt;Serve every page over HTTPS and redirect plain HTTP to it. Send a &lt;code&gt;Strict-Transport-Security&lt;/code&gt; header, so browsers stop trying the insecure version at all. In Settings → General, make sure both the WordPress Address and the Site Address start with &lt;code&gt;https://&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  14. Send security headers
&lt;/h3&gt;

&lt;p&gt;A few response headers close off whole classes of attack, such as another site loading yours in a frame to trick visitors into clicking (clickjacking), or a browser guessing a file's type. My own site, &lt;a href="https://devangwp.com" rel="noopener noreferrer"&gt;devangwp.com&lt;/a&gt;, sends these five on every response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Strict-Transport-Security: max-age=63072000
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=(), interest-cohort=()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A Content Security Policy is the strongest header and the hardest one on WordPress, because many plugins add inline scripts. Start it in report-only mode (&lt;code&gt;Content-Security-Policy-Report-Only&lt;/code&gt;), fix what it reports, and enforce it once the reports are clean. The &lt;a href="https://owasp.org/www-project-secure-headers/" rel="noopener noreferrer"&gt;OWASP Secure Headers Project&lt;/a&gt; explains each header in detail.&lt;/p&gt;

&lt;h3&gt;
  
  
  15. Run a PHP version that still gets security fixes
&lt;/h3&gt;

&lt;p&gt;Each PHP version stops receiving security fixes on a published date. PHP 8.2's security support ends on 31 December 2026, so aim for PHP 8.3 or newer, after testing your theme and plugins on it. The current dates are on &lt;a href="https://www.php.net/supported-versions.php" rel="noopener noreferrer"&gt;php.net&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  16. Put a firewall in front of the site
&lt;/h3&gt;

&lt;p&gt;A web application firewall blocks known attack patterns and abusive traffic before they reach WordPress. It can come from your host, from a CDN in front of the site, or from a security plugin. The earlier in the chain it sits, the less load attacks put on your server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recovery and monitoring
&lt;/h2&gt;

&lt;h3&gt;
  
  
  17. Automatic backups, stored somewhere else, and a tested restore
&lt;/h3&gt;

&lt;p&gt;Back up the database and files every day, and keep the backups off the server: if the server is compromised or lost, backups stored on it go with it. A backup you've never restored is a hope, not a plan, so restore one to staging every few months.&lt;/p&gt;

&lt;h3&gt;
  
  
  18. Check files against the official versions
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://developer.wordpress.org/cli/commands/core/verify-checksums/" rel="noopener noreferrer"&gt;WP-CLI&lt;/a&gt; can compare WordPress core, and plugins from WordPress.org, against the official checksums, and list any file that has been changed or added:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp core verify-checksums
wp plugin verify-checksums --all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Anything flagged that you didn't change yourself deserves a closer look. Run both on a schedule, alongside a malware scanner.&lt;/p&gt;

&lt;h3&gt;
  
  
  19. Keep an activity log
&lt;/h3&gt;

&lt;p&gt;Record logins, failed logins, new users, role changes, and plugin or theme installs. When something goes wrong, the log tells you when it started and which account was used.&lt;/p&gt;

&lt;h3&gt;
  
  
  20. Write down what you'll do when it happens
&lt;/h3&gt;

&lt;p&gt;One page is enough: where the backups are, who has access to the hosting and the domain, and the order of work. Put the site into maintenance mode, keep a copy of the hacked files and logs, restore a clean backup, update everything, change every password and replace the keys and salts (step 9), then work out how they got in so it can't happen again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advice that's worth less than it sounds
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Renaming the login page.&lt;/strong&gt; It cuts down noise in the logs, but it's hiding, not protection. Login limits and two-factor authentication (steps 4 and 5) do the real work.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Changing the database table prefix.&lt;/strong&gt; It doesn't stop SQL injection. Updating or removing the vulnerable plugin does.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Installing several security plugins.&lt;/strong&gt; They overlap, slow the site down and can conflict with each other. One well-configured tool plus the server-level steps above is better than three.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How often to check
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Every week:&lt;/strong&gt; updates (step 1), and a quick look at the backups and the activity log.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Every three months:&lt;/strong&gt; review users and roles, delete unused plugins, and test a restore.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When a staff member or agency leaves:&lt;/strong&gt; remove their accounts, change any shared passwords, and replace the keys and salts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Common questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Is WordPress secure?
&lt;/h3&gt;

&lt;p&gt;WordPress core has a dedicated security team and is patched quickly. Most problems come from outdated or abandoned plugins and themes, weak passwords, and hosting that isn't kept up to date, which are exactly what the steps above deal with.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I need a security plugin?
&lt;/h3&gt;

&lt;p&gt;Not necessarily. A security plugin is a convenient way to get login limits, two-factor authentication, a firewall and scanning in one place, but each of those can also come from your host or your server. What matters is that every step is covered, not which tool covers it.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I know if my site has been hacked?
&lt;/h3&gt;

&lt;p&gt;Common signs are admin users you don't recognise, new files in &lt;code&gt;wp-content&lt;/code&gt; that you didn't add, spam pages or redirects that only show up in search results or on mobile, and a warning in Google Search Console under Security &amp;amp; Manual Actions. Step 18 catches changed files early, often before any of these appear.&lt;/p&gt;

&lt;h2&gt;
  
  
  More on how I work
&lt;/h2&gt;

&lt;p&gt;Security audits and hardening are part of my WordPress work, shaped by a security background that came before my front-end work. See &lt;a href="https://devangwp.com/services#performance-security-audits" rel="noopener noreferrer"&gt;performance and security&lt;/a&gt; and the &lt;a href="https://devangwp.com/work/security-hardening" rel="noopener noreferrer"&gt;security hardening case study&lt;/a&gt;. Hiring for a WordPress role? &lt;a href="https://devangwp.com/contact" rel="noopener noreferrer"&gt;Get in touch&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>security</category>
      <category>webdev</category>
      <category>php</category>
    </item>
  </channel>
</rss>
