BetterShield
Appearance
HardeningSecurity auditChecklist

WordPress hardening: 30 one-click fixes and what each changes

· · 13 min read

Updated by Nazmul Hasan Rupok on

WordPress hardening means closing the doors a default install leaves open: an API most sites no longer use, a code editor in the dashboard, uploads folders that can run PHP. Most hardening checklists tell you what to change and leave the how to you.

BetterShield turns thirty of those changes into switches. Each one says what it will change before you turn it on, and each one is logged. This guide covers all thirty, what each can affect, and which to watch on real traffic first.

Quick summary

  • The non-sign-in fixes are on BetterShield › Protection › Hardening. Those changing how people sign in are under Signing in on Protection › Login & Access.
  • Every fix but one starts off: Server detail protection is on from activation, including on sites that update. Preview the change lists what applying would do and changes nothing.
  • Five fixes offer Monitor first: they count matching requests for an hour, a day or a week before anything is enforced.
  • Turning a switch off undoes the fix. Two effects sit outside any undo: sessions ended by a key change, and an HSTS setting browsers already saw.
  • Five audit findings have an Apply fix button, and Quick Setup offers five initial fixes with compatibility notes to review.

How to harden WordPress with BetterShield

The Hardening screen opens with your score, how many Protections are on (such as “3 of 11”), the checks run and the open findings. Under How this works, one line sums up the rules: “Each item applies on its own and reverts on its own. Nothing here is batched, and every change is recorded.” Each group is then a card with its own count, such as “2 of 5 on”.

Every fix works the same way:

  1. Fill in any field the fix has, then press Preview the change. It lists what applying would do and says: “This is a preview. Nothing was changed and nothing was written.”
  2. Turn the switch on. The row shows On since and Undo never expires.
  3. To undo, turn the switch off. A fix that wrote a file takes out what it added.

If another security plugin already does a fix’s job, the row says so. A fix your server cannot run shows Not available here with the reason. Safe mode, started from your recovery link, pauses every fix that runs inside WordPress, except the strengthened sign-in keys, and keeps its settings; rules written to .htaccess and index files stay in place.

Apply with evidence

Dependency → change → proof

Use this small loop for each setting rather than switching on a group.

  1. Name the dependency

    Who or what uses this route?

  2. Choose one change

    Preview its exact scope.

  3. Prove the outcome

    Check the result and the workflow.

Name the dependency

What this means
A mobile publisher, author directory, payment frame or API client may depend on a feature the audit flags.
Your next check
Ask the owner and exercise a representative workflow; a quiet log alone is insufficient.

Choose one change

What this means
Check the server supports it and identify whether it runs in WordPress or writes a persistent server rule.
Your next check
Keep recovery and a rollback route available at the layer where the change takes effect.

Prove the outcome

What this means
An enabled switch is only intended state. Confirm the observable behavior and the legitimate task both match expectations.
Your next check
Record the result, then move to the next fix. If it fails, undo this change before adding another.
Prioritize exposure and impact over the number of enabled switches. Some settings are intentionally unsuitable for a particular site.

The WordPress hardening checklist, fix by fix

The thirty fixes, in the screen’s own groups and order.

What the site reveals

FixWhat it changesWhat it can affect
Username privacyChanges supported public user-list, numeric author, sitemap and embed routes; direct author archives can remain public. A wrong password and an unknown username get the same answer.A mistyped address on the lost-password form is told a link is coming, and none arrives.
Folder listing protectionAdds a blank index.php to uploads folders without an index file, two levels deep.Depends on the server honoring the index file; verify the served directory response.
Private file protection.htaccess rules answer 404 for logs, wp-config backups, readme.html, license.txt, .git and .env.Needs a server that reads these .htaccess rules, such as Apache. On nginx or OpenLiteSpeed, the row says so.
WordPress version privacyRemoves the version from the generator tag, feeds and asset addresses.Plugin and theme versions stay.
Server detail protectionRefuses requests made through WordPress to the addresses where a cloud server keeps its credentials, whichever plugin makes them. On from activation.Something you run that must reach one of them: add it under Addresses to let through, or switch the fix off.

What can run

FixWhat it changesWhat it can affect
Remote publishing block (XML-RPC)Answers xmlrpc.php with 403, or with Pingbacks only removes just the pingback methods. The REST API is untouched.The WordPress mobile app and Jetpack, if you publish through them and turn all of it off.
File editor lockRemoves the plugin and theme code editors.In the plugin’s words, “Files stay editable over SFTP and through your host.”
Uploads code blockAn uploads .htaccess rule answers 404 for PHP files there.Needs a server that reads these .htaccess rules, such as Apache. Images and documents are unaffected.

What browsers are told

FixWhat it changesWhat it can affect
Strict HTTPS (HSTS)Sends HSTS for Five minutes, to prove it works or six months.A browser that saw six months keeps it after you undo. Start short.
Script-blocking policySends a report-only content policy and lists what it would block.Nothing is blocked. Start enforcing this policy waits for 7 days with no reports.
Browser protectionsAdds four standard headers, leaving any your server sends.Another site that frames your pages stops showing them. WordPress embeds of your posts keep working.

Signing in

FixWhat it changesWhat it can affect
Custom sign-in addressServes sign-in at your New sign-in address. wp-login.php answers 404.Keep the address off the site. The recovery link restores the standard page.
App password blockRefuses them for Accounts that can manage this site or Every account. Nothing is deleted.Tools that sign in with one stop working.
Leaked password checkChecks a new password against Pwned Passwords, sending five characters of its hash.Signing in is never affected.
Dashboard lock for customers and subscribersSends the roles you choose (Subscriber is preselected) from wp-admin to the front page, except their profile.Never a role that can manage the site or has work in the dashboard.
Dashboard privacy for visitorsSigned-out visitors get a 404 at /wp-admin/.admin-ajax.php and admin-post.php keep working.
Sign everyone out on demandMixes a strong secret into the keys that sign sessions, and adds Rotate keys now.Applying, rotating and undoing all sign every other session out, your own other devices included.

Two pairs work well together. Custom sign-in address notes that /wp-admin/ still sends signed-out visitors to the new address, and suggests Dashboard privacy for visitors too. And Remote publishing block (XML-RPC) leaves application passwords working over the REST API, which App password block covers.

Field-by-field details are in the Hardening guide.

Monitor first: try a fix on real requests

The preview describes the change and may include past activity. Monitor first observes matching requests over a selected window. It is offered for Remote publishing block (XML-RPC) and four sign-in fixes: Custom sign-in address, App password block, Dashboard lock for customers and subscribers and Dashboard privacy for visitors.

  1. Press Monitor first at the end of the row and choose a New observation window: 1 hour, 24 hours (preselected) or 7 days.
  2. Press Start monitoring with the fields above. Nothing is blocked while it watches.
  3. The panel counts what arrives, as “38 requests observed; 3 matched this rule.”
  4. When the window ends, press Enforce reviewed settings. It needs a working recovery link or printed recovery codes, and the normal undo still works.

Dashboard lock for customers and subscribers adds Automatic undo for the first 24 hours, after 1, 5 or 10 signed-in denials. Keep undo manual is preselected.

Read the counts with care. As the panel says, matches show what the rule would affect, not proven breakage, and bots can add to them. Requests handled before WordPress are not counted, so an empty count proves nothing either.

For XML-RPC and application passwords, Preview the change also answers from your activity log, with a line such as “Nothing has used this in the last 30 days, which is as far back as this site’s log goes.”

Sign-in fixes check your way back in first

Applying a Signing in fix first checks for a working recovery link or an unused printed code, checked within the last day. If that fails, Check the way back in first opens with Check now or Open Recovery. Go ahead anyway is allowed, and is written to the activity log with the check that did not pass.

What undo cannot reach

Turning a switch off reverses the fix. Two effects reach beyond the site, and the fixes say so before you apply them:

  • Sign everyone out on demand: people it signed out stay signed out until they sign in again. Rotate keys now has no undo.
  • Strict HTTPS (HSTS): a browser that saw the six-month setting keeps insisting on HTTPS until it expires. At five minutes, it forgets within five minutes.

Where to start

  1. Quick Setup’s five safe fixes: File editor lock, WordPress version privacy, Block directory browsing, Stop username discovery and Add security headers. See Install and set up.
  2. Findings with Apply fix: XML-RPC, the file editor, public user listing, the WordPress version and the missing headers. Worth doing first on the Overview lists up to three. See Score and findings and the checklist.
  3. The rest, one at a time: preview each, watch the ones that offer Monitor first, and apply them on a quiet day.

From WP-CLI or an AI assistant

wp bettershield harden lists every fix with its ID. wp bettershield harden xmlrpc --dry-run previews one, --user=admin applies it, and --undo reverses it. See WP-CLI commands.

A connected assistant allowed to make changes can apply the reversible fixes directly. The sign-in fixes, and taking any fix off, need a plan you agree to in the conversation. See Connect an AI assistant.

Keep a change record that proves the result

Before each fix, write down its owner and the legitimate task it might affect. The owner could be WordPress, another plugin, the web server or the CDN. An enabled switch and a working page do not necessarily establish that the intended control is running.

Worked example (fictional): a site serves its home page entirely from a CDN cache. The owner enables security headers in WordPress and sees the switch on, but a signed-out request still receives the old cached response. The next step is to inspect the final response and clear or update the responsible cache, not add the same header blindly at several layers.

For each change, collect two kinds of evidence:

EvidenceExample
Intended restrictionThe public endpoint returns the expected refusal, the file editor is unavailable, or the final response carries the intended header.
Legitimate work still succeedsThe publisher posts from its normal client, a customer completes a test checkout, or an editor uses the intended workflow.

Keep the rollback route at the same layer as the change. Safe mode can pause BetterShield’s runtime enforcement, but it does not remove persistent server rules or recall an HSTS policy already stored by a browser. A backup and authorized hosting access remain necessary.

If a fix is inappropriate because an integration needs the feature, document that dependency and the compensating controls. A deliberate exception with an owner and review date is more useful than enabling every switch to make a count look complete.

Common mistakes

  • Turning on several sign-in fixes at once. If something stops working, you will not know which one did it.
  • Starting HSTS at six months. Prove it at five minutes first.
  • Doing the same job in two plugins. If a row says another plugin already does it, leave it to one of them.
  • Reading a quiet Monitor first window as a green light. Read it with the preview, and choose a week for anything that connects now and then.

Additional fixes in the current release

The current 30-fix inventory also includes these controls. Read each guide before enabling it.

FixWhat it changes
Shorter reset links for admins and editorsPassword-reset links for administrators and editors expire sooner than the usual 24 hours.
Confirm email changes for admins and editorsA new email address on these accounts only takes effect once it is confirmed from that inbox.
New sign-ups start as SubscriberNew accounts start as Subscriber. Existing accounts keep their roles.
Limit scripts and any-type uploads to adminsNon-admins can no longer add scripts to posts or upload any file type. No role is changed.
Limit SVG and code file uploads to adminsAccounts below administrator can no longer upload SVG, HTML, JavaScript or PHP-type files.
Limit other plugins’ site-changing actions to adminsSome plugins let any signed-in user run actions that change the site, for example through an AI assistant. This limits them to administrators.
Hide error messages from visitorsHides error details from pages; your error log still records them.
Keep the sign-in page out of page cachesTells caching plugins, server caches and CDNs not to keep a copy of the sign-in page. No files change.
Keep BetterShield up to date by itselfSwitches on BetterShield’s own auto-updates, as its row under Plugins does.
Lock key site settings to administratorsStops plugins and themes changing the site address, admin email or sign-up settings.
Switch the site address to HTTPSChecks the certificate first. Goes back to http on its own unless you press Keep HTTPS within 5 minutes.
Always use the secure addressVisitors who open an http:// link are sent to your https:// address.
Stop other websites reading your site’s dataStops other websites reading data meant for your signed-in visitors.

Frequently asked questions

Is WordPress hardening safe on a live site?

Every fix can show what it will change before you apply it, and turning the switch off reverses it, with the two limits above. Five fixes that can stop a tool or a person also offer Monitor first.

Do I have to apply all 30 fixes?

No. Each fix applies on its own, so choose the ones that suit your site. Some depend on your setup: the .htaccess fixes need a server that reads their rules, such as Apache, and HSTS needs an HTTPS address.

Does hardening change my files?

Three fixes write files: Folder listing protection adds blank index.php files, and Private file protection and Uploads code block add a marked block to .htaccess. Undo takes out what they added. The other fourteen work while WordPress runs and write no files.

What happens to the fixes if I delete BetterShield?

Saved settings and files written by fixes can remain by default. Runtime controls require BetterShield to be loaded; retaining a setting does not keep that code running after deletion. Undo unwanted server rules before removal, and review the deletion option under Settings › General.

Conclusion

WordPress hardening works best as small steps you can see and reverse. Start with relevant low-disruption fixes after reading their compatibility notes, close the findings that offer Apply fix, then watch the sign-in fixes on real traffic before you enforce them.

BetterShield is free on WordPress.org. The features page shows everything else it does.

Close the open doors today

Install the free plugin. The first audit runs when you activate it, and all but one of the fixes wait for your choice.

Requires WordPress 6.7 or newer and PHP 8.0 or newer.

Get BetterShield