How to Secure a WordPress Website

No single plugin makes a site secure. Good WordPress security comes from layers, so that if one fails, the others still protect you. This checklist covers each layer in order of impact.

Illustration of a shield protecting a website
On this page
  1. 1. Keep everything updated
  2. 2. Remove what you don't use
  3. 3. Lock down logins
  4. 4. Give people only the access they need
  5. 5. Turn off the built-in file editor
  6. 6. Use HTTPS and secure connections
  7. 7. Add a firewall and scanning
  8. 8. Back up, and test a restore
  9. 9. Monitor your site
  10. What your host should handle
  11. If your site is hacked
  12. Your security checklist
  13. Frequently asked questions
  14. Sources

Most WordPress sites aren't attacked because someone picked them out. They're found by automated scans looking for outdated plugins, weak passwords and other known weaknesses. That's good news: a few consistent habits close most of those gaps. This tutorial sets them out in order, starting with the steps that make the biggest difference.

Stacked diagram of five WordPress security layers: hosting and firewall, HTTPS, updates, logins and roles, and backups and monitoring.
The sections below walk through each layer.

1. Keep everything updated

Outdated plugins and themes are one of the most common ways WordPress sites are compromised, because once a vulnerability is published, automated tools look for sites that haven't fixed it. WordPress's own hardening guide puts staying up to date first.

  • WordPress core: WordPress installs minor and security releases automatically by default. Apply major releases promptly, after checking that your theme and key plugins support them.
  • Plugins and themes: since WordPress 5.5, you can switch on automatic updates for each plugin and theme from the admin screens. Consider it for well-maintained plugins you trust.
  • Test bigger changes first. If your host offers a staging site, try major updates there before applying them to the live site.

2. Remove what you don't use

Delete plugins and themes you aren't using; deactivated code can still contain vulnerabilities. Install new ones only from trusted sources, such as the WordPress.org plugin directory or well-known developers, and check that a plugin has been updated recently before you rely on it.

3. Lock down logins

  • Use a unique, long password for every account, generated and stored by a password manager. Avoid usernames that are easy to guess, such as "admin" or your domain name.
  • Turn on two-step authentication for every administrator. WordPress doesn't build it in; its handbook points to two-step authentication plugins, and recommends app-based codes over SMS, which it describes as not a secure channel.
  • Limit repeated login attempts through your host's protection or a security plugin, to slow down password-guessing attacks.
  • Protect the accounts around WordPress too: your hosting account, domain registrar and email should all use strong passwords and two-step sign-in.

4. Give people only the access they need

WordPress has built-in roles, from Administrator down to Subscriber. Give each person the lowest role that lets them do their job: most writers need Author or Editor, not Administrator. Remove accounts for people who no longer work on the site.

WordPress Add User screen with fields for username, email and password, and a Role dropdown.
Users, Add User, from a test install of WordPress 7.1.4. The Role dropdown sets what the person can do.

5. Turn off the built-in file editor

WordPress includes a screen for editing theme and plugin code from the dashboard. If an attacker gets into an administrator account, it lets them change code immediately. The hardening guide recommends switching it off by adding this line to wp-config.php:

define( 'DISALLOW_FILE_EDIT', true );

This doesn't stop every attack, but it removes an easy one.

6. Use HTTPS and secure connections

  • Make sure every page loads over HTTPS and that the http version redirects to it, so logins and admin pages are always encrypted.
  • Use SFTP rather than FTP to transfer files. FTP sends your password unencrypted; SFTP encrypts it.

7. Add a firewall and scanning

A web application firewall filters malicious requests before they reach WordPress. Many hosts include one at the server level. If yours doesn't, the options include a security plugin with a firewall, or a service that filters traffic before it reaches your server. Use one security plugin, not several, because overlapping plugins can conflict.

8. Back up, and test a restore

Backups are your safety net when everything else fails. Following WordPress's backup guidance:

  • Back up both the database and the files. The database holds your posts and settings; the files hold WordPress, plugins, themes, uploads and wp-config.php. You need both to restore a site.
  • Back up regularly: weekly suits smaller sites, and daily suits busy sites that change often. Always back up before an update or a move.
  • Keep several copies in different places, such as your host, cloud storage and your own computer. A backup stored only in your hosting account won't help if that account is the problem.
  • Test a restore occasionally, so you know the process works before you need it.
Three panels showing where to keep website backups: with your host, in cloud storage and on your own computer.
Based on WordPress's backup guidance: back up the database and the files, and keep copies in different places.

Before you buy hosting, compare how often each host backs up and how long it keeps copies.

9. Monitor your site

  • Use an uptime monitor that emails you if the site goes down, so you hear about problems before your customers do.
  • Consider an activity log that records logins and changes, which helps you see what happened if something goes wrong.
  • Check Google Search Console from time to time; it can alert you to security issues Google finds on your site.

What your host should handle

Good hosting does a lot of this work for you. When choosing or reviewing a host, check whether it isolates accounts from each other, runs a firewall and malware scanning, keeps automatic backups off the server, and lets you restore them yourself. Our guide on how to choose reliable hosting covers the questions to ask, and our hosting reviews list what each provider includes.

If your site is hacked

  1. Don't panic, and don't delete everything. Take a copy of the site as it is, which helps you or a specialist find out what happened.
  2. Contact your host. Many can identify the problem from server logs, and some will help with the clean-up.
  3. Change every password: WordPress users, hosting, database, SFTP and the email account linked to the site.
  4. Restore a clean backup from before the problem started, or have the site cleaned.
  5. Update everything and remove unknown users, plugins and themes, then work through this checklist to close the gap that let the attacker in.

Your security checklist

  • WordPress, themes and plugins are up to date
  • Unused plugins and themes are deleted
  • Every administrator has a unique password and two-step authentication
  • Each user has the lowest role they need
  • The dashboard file editor is switched off
  • The whole site uses HTTPS, and files are transferred with SFTP
  • A firewall is in place at the host or in one security plugin
  • Backups run automatically, are stored in more than one place and have been tested
  • An uptime monitor is set up

Frequently asked questions

Do I need a security plugin?

Not always. If your host provides a firewall, malware scanning and backups, a plugin may add little. If it doesn't, one reputable security plugin can fill the gap. Either way, updates and strong logins matter more than any plugin.

Is WordPress secure?

WordPress core is actively maintained and receives security updates. Most problems come from outdated plugins and themes, weak passwords and poor hosting, which are all things you can control.

How often should I back up my WordPress site?

WordPress's guidance suggests weekly for smaller sites and daily for busy sites, plus a backup before every update. Keep several recent copies in different places.

Should I change the default "wp_" database prefix?

The hardening guide mentions it as an option, but it's a minor measure and best set when you install. Focus on updates, logins and backups first.

For specific plugins worth considering, see best WordPress tools for beginners.

Sources

Checked .