<?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: Aukark</title>
    <description>The latest articles on DEV Community by Aukark (@aukarkofficial).</description>
    <link>https://dev.to/aukarkofficial</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%2F4181015%2F20507c02-8fa9-4c3b-b2b0-a903183a1f96.png</url>
      <title>DEV Community: Aukark</title>
      <link>https://dev.to/aukarkofficial</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aukarkofficial"/>
    <language>en</language>
    <item>
      <title>Hardening a WordPress site: a practical checklist for developers</title>
      <dc:creator>Aukark</dc:creator>
      <pubDate>Mon, 23 Nov 2026 14:55:42 +0000</pubDate>
      <link>https://dev.to/aukarkofficial/hardening-a-wordpress-site-a-practical-checklist-for-developers-9no</link>
      <guid>https://dev.to/aukarkofficial/hardening-a-wordpress-site-a-practical-checklist-for-developers-9no</guid>
      <description>&lt;p&gt;If you maintain WordPress sites, most of the risk is not a mysterious flaw in core. It is an outdated plugin, a writable directory, or an administrator who can edit PHP from the dashboard. Hardening shrinks that attack surface and contains the damage if something still gets through.&lt;/p&gt;

&lt;p&gt;The WordPress project treats this as risk reduction, not risk elimination, and keeps a detailed &lt;a href="https://developer.wordpress.org/advanced-administration/security/hardening/" rel="noopener noreferrer"&gt;Hardening WordPress&lt;/a&gt; guide up to date. What follows is the subset I apply before a site goes to production, plus a few server-level checks the dashboard will not show you.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Treat &lt;code&gt;wp-config.php&lt;/code&gt; as a secret, not a settings file
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;wp-config.php&lt;/code&gt; holds the database password and the authentication keys. The official guide allows you to store it one directory level above the WordPress root, and it recommends permissions of &lt;code&gt;400&lt;/code&gt; or &lt;code&gt;440&lt;/code&gt; so that only you and the web server can read it. On Apache, you can also deny HTTP access at the very top of &lt;code&gt;.htaccess&lt;/code&gt;:&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Files&lt;/span&gt; &lt;span class="s2"&gt;"wp-config.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;p&gt;Moving the file has trade-offs if you do it carelessly, so test the install afterwards. The change that matters more on almost every site is this constant:&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;p&gt;That removes the theme and plugin editors from the dashboard â€” the equivalent of taking away the &lt;code&gt;edit_themes&lt;/code&gt;, &lt;code&gt;edit_plugins&lt;/code&gt;, and &lt;code&gt;edit_files&lt;/code&gt; capabilities. It will not stop an attacker who can already upload files, but it closes a common next step after a stolen admin session. Leave debugging off in production.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Use a tight permission scheme, then loosen it only when you must
&lt;/h2&gt;

&lt;p&gt;Writable files are convenient and, on shared hosting, also a hazard. The &lt;a href="https://developer.wordpress.org/advanced-administration/security/hardening/#file-permissions" rel="noopener noreferrer"&gt;file permissions&lt;/a&gt; section of the official guide is the scheme I start from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The WordPress root, &lt;code&gt;wp-admin&lt;/code&gt;, and &lt;code&gt;wp-includes&lt;/code&gt; should be writable only by your user account, except &lt;code&gt;.htaccess&lt;/code&gt; if you want WordPress to write rewrite rules.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;wp-content&lt;/code&gt; is the exception: uploads need to be writable by the web server process.&lt;/li&gt;
&lt;li&gt;Plugin files under &lt;code&gt;wp-content/plugins&lt;/code&gt; should be writable only by your user account. Theme files can follow the same rule if you are not using the built-in theme editor.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have shell access, the documented baseline is directories at &lt;code&gt;755&lt;/code&gt; and files at &lt;code&gt;644&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;find /path/to/your/wordpress/install/ -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 /path/to/your/wordpress/install/ -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;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then tighten &lt;code&gt;wp-config.php&lt;/code&gt; to &lt;code&gt;400&lt;/code&gt; or &lt;code&gt;440&lt;/code&gt;. When WordPress runs an automatic update, it performs file operations as the file owner and resets files to &lt;code&gt;0644&lt;/code&gt; and directories to &lt;code&gt;0755&lt;/code&gt;, so re-check permissions after a core update if you use a stricter scheme.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Give the database user only what the app needs
&lt;/h2&gt;

&lt;p&gt;If you host more than one WordPress site on a server, keep them in separate databases with separate users, so a compromise of one install is harder to turn into a compromise of the others.&lt;/p&gt;

&lt;p&gt;For day-to-day publishing, media, comments, users, and plugin installs, the official guide says the MySQL user only needs &lt;code&gt;SELECT&lt;/code&gt;, &lt;code&gt;INSERT&lt;/code&gt;, &lt;code&gt;UPDATE&lt;/code&gt;, and &lt;code&gt;DELETE&lt;/code&gt;. Privileges such as &lt;code&gt;DROP&lt;/code&gt;, &lt;code&gt;ALTER&lt;/code&gt;, and &lt;code&gt;GRANT&lt;/code&gt; can be revoked to limit damage. Read the warning that follows: some plugin installs and major upgrades change the schema. The projectâ€™s own guidance is that revoking structural privileges is not the default recommendation. If you still want that tighter posture, grant the extra privileges back before an update, keep backups you have actually restored, and tighten the grants again only after the update succeeds.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Shrink the admin surface
&lt;/h2&gt;

&lt;p&gt;Two kinds of attacks show up again and again: crafted requests against outdated plugins, and brute-force guessing against &lt;code&gt;wp-login.php&lt;/code&gt;. The &lt;a href="https://developer.wordpress.org/advanced-administration/security/brute-force/" rel="noopener noreferrer"&gt;brute force documentation&lt;/a&gt; is worth a single careful read.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Require HTTPS for the admin area and the login screen so credentials and cookies are not sent in the clear. The hardening guide points to administration over SSL for this second layer.&lt;/li&gt;
&lt;li&gt;Use unique, long passwords and two-factor authentication on every administrator account. Do not share one administrator login across a team, and give each person the least capability they need.&lt;/li&gt;
&lt;li&gt;A server-level password in front of &lt;code&gt;/wp-admin/&lt;/code&gt; will stop a lot of automated probes, but it can break &lt;code&gt;wp-admin/admin-ajax.php&lt;/code&gt; if you wrap the whole directory blindly. Allow that endpoint through, or protect only &lt;code&gt;wp-login.php&lt;/code&gt;, and test the block editor after you add the rule.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the site does not use the WordPress mobile app, Jetpack, or pingbacks, you can also disable XML-RPC at the server â€” only after you have confirmed nothing in the stack still depends on &lt;code&gt;xmlrpc.php&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Block direct access to include-only PHP
&lt;/h2&gt;

&lt;p&gt;PHP files under &lt;code&gt;wp-includes&lt;/code&gt; are not meant to be hit in the browser. On Apache, the official guide adds a second layer with &lt;code&gt;mod_rewrite&lt;/code&gt;. Place this &lt;em&gt;outside&lt;/em&gt; the &lt;code&gt;# BEGIN WordPress&lt;/code&gt; and &lt;code&gt;# END WordPress&lt;/code&gt; markers, or a permalink flush will overwrite it:&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;# Block the include-only files.
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;IfModule&lt;/span&gt; &lt;span class="n"&gt;mod_rewrite&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nc"&gt;RewriteEngine&lt;/span&gt; &lt;span class="nc"&gt;On&lt;/span&gt;
&lt;span class="nc"&gt;RewriteBase&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;
&lt;span class="nc"&gt;RewriteRule&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;admin&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;includes&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="no"&gt;F&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="no"&gt;L&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="na"&gt;RewriteRule !^wp-includes/ - [S&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nc"&gt;RewriteRule&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;includes&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="o"&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="p"&gt;[&lt;/span&gt;&lt;span class="no"&gt;F&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="no"&gt;L&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nc"&gt;RewriteRule&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;includes&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;js&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;tinymce&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;langs&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="n"&gt;php&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="no"&gt;F&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="no"&gt;L&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nc"&gt;RewriteRule&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;includes&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;theme&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;compat&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="no"&gt;F&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="no"&gt;L&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;IfModule&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Skip or adapt the &lt;code&gt;wp-includes/[^/]+\.php&lt;/code&gt; rule on Multisite; it can break &lt;code&gt;ms-files.php&lt;/code&gt;. On Nginx, the same idea is a location block that denies those PHP files rather than a rewrite copied from Apache.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Treat plugins as code you agreed to run
&lt;/h2&gt;

&lt;p&gt;Keep plugins updated, and delete the ones you are not using. A deactivated plugin is still files on the disk. Install only from a source you can name â€” start with the &lt;a href="https://wordpress.org/plugins/" rel="noopener noreferrer"&gt;WordPress.org plugin directory&lt;/a&gt; â€” and check the last updated date before you add anything.&lt;/p&gt;

&lt;p&gt;A firewall plugin or a web application firewall can help. If you add one, watch what it injects on the front end. Extra JavaScript on every page can delay Interaction to Next Paint, one of the &lt;a href="https://aukark.com/blog/core-web-vitals-impact" rel="noopener noreferrer"&gt;Core Web Vitals&lt;/a&gt; Google uses when it assesses experience.&lt;/p&gt;

&lt;p&gt;Security headers belong at the server or CDN. A cautious starting set is &lt;code&gt;X-Content-Type-Options: nosniff&lt;/code&gt;, a strict &lt;code&gt;Referrer-Policy&lt;/code&gt;, and &lt;code&gt;Content-Security-Policy&lt;/code&gt; with &lt;code&gt;frame-ancestors&lt;/code&gt;. MDNâ€™s &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy" rel="noopener noreferrer"&gt;Content-Security-Policy&lt;/a&gt; documentation is the right reference. Introduce CSP in report-only mode first: a strict policy will otherwise break the block editor and a surprising number of plugins. This is the same class of work as the &lt;a href="https://owasp.org/www-project-top-ten/" rel="noopener noreferrer"&gt;OWASP Top Ten&lt;/a&gt; injection and misconfiguration items â€” limit what the browser will execute, and do not ship a policy you have not tested.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Keep a backup you have restored
&lt;/h2&gt;

&lt;p&gt;A backup that has never been restored is a hope. Back up regularly, including the MySQL database, and keep a copy off the same server. After a hardening change or a core update, restore onto staging and confirm that the homepage, a form, and the login still work.&lt;/p&gt;

&lt;p&gt;For a less technical walkthrough of updates, backups, two-factor login, and what to do if a site is already compromised, we published a step-by-step guide on &lt;a href="https://aukark.com/blog/how-to-secure-wordpress-website" rel="noopener noreferrer"&gt;how to secure a WordPress website&lt;/a&gt;. The developer work in this article sits underneath that checklist; it does not replace it.&lt;/p&gt;

&lt;h2&gt;
  
  
  A pre-deploy checklist
&lt;/h2&gt;

&lt;p&gt;Use this as a deploy gate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Core, themes, and plugins are current; unused plugins and themes are deleted (keep one default theme).&lt;/li&gt;
&lt;li&gt;[ ] &lt;code&gt;DISALLOW_FILE_EDIT&lt;/code&gt; is true; &lt;code&gt;wp-config.php&lt;/code&gt; is not HTTP-readable and is mode &lt;code&gt;400&lt;/code&gt; or &lt;code&gt;440&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;[ ] Directories are &lt;code&gt;755&lt;/code&gt;, files are &lt;code&gt;644&lt;/code&gt;, and &lt;code&gt;wp-content&lt;/code&gt; write access is limited to what uploads require.&lt;/li&gt;
&lt;li&gt;[ ] The database user is unique to this site; structural privileges are understood and documented if you tightened them.&lt;/li&gt;
&lt;li&gt;[ ] Admin and login run over HTTPS; administrators use unique credentials and two-factor authentication.&lt;/li&gt;
&lt;li&gt;[ ] Include-only PHP under &lt;code&gt;wp-includes&lt;/code&gt; and &lt;code&gt;wp-admin/includes&lt;/code&gt; is blocked, and Multisite was considered.&lt;/li&gt;
&lt;li&gt;[ ] Security headers are set at the server; CSP was tested against wp-admin and the front end.&lt;/li&gt;
&lt;li&gt;[ ] A full backup was restored on staging after the last change.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of this makes a site untouchable. It does make the common paths harder, and it gives you a way back when something still goes wrong.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Lokendra Singh, Founder at Aukark. Aukark is a Gurugram studio working on web, UI/UX, and SEO.&lt;/em&gt;&lt;/p&gt;

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