WordPress Security: 7 Steps to Protect Your Site

Affiliate Disclosure: Some links on this page are affiliate links. If you purchase through our links, we may earn a commission at no extra cost to you.

Last updated: December 1, 2026 · Reading time: about 15 minutes

WordPress security means keeping your site’s software current, protecting logins, limiting what attackers can reach and having a backup ready. The most effective steps are: update WordPress, themes and plugins; use strong unique passwords with two-factor login; install only trusted plugins; use HTTPS; limit login attempts and user roles; and keep tested backups. These habits stop the large majority of attacks on ordinary sites.

Key takeaways

  • Most hacked WordPress sites run outdated software or weak passwords. Updates and good logins matter most.
  • Plugins and themes are the biggest risk area. Install fewer, from trusted sources, and delete unused ones.
  • Turn on two-factor authentication for every admin and editor.
  • Give each user only the role they need. Few people should be Administrators.
  • A tested, off-site backup turns a hack into a short repair. See our WordPress backup guide.
Four layers of WordPress security: host, software, logins and backups
Good security has layers, so one failure does not take the site down.

Is WordPress secure?

WordPress core is actively maintained and is reasonably secure; most compromises come from plugins, themes, weak passwords and neglected updates. WordPress powers a large share of the web, so attackers target it with automated scans. They look for known flaws in old software and for easy logins. You do not have to be a target to be hit.

That is good news. It means a small set of habits protects you from most automated attacks. The official WordPress hardening guide, the Wordfence security checklist and Cloudflare’s WordPress security guide all describe the same core ideas, and we use them as the basis for this article.

How do attackers get into WordPress sites?

The common entry points are vulnerable plugins or themes, stolen or guessed passwords, and weak hosting.

  • Known vulnerabilities in plugins and themes. When a flaw is published and fixed, attackers scan for sites that have not updated.
  • Brute-force and credential stuffing. Bots try common passwords, or passwords leaked from other sites.
  • Nulled (pirated) themes and plugins. Free copies of paid products often contain hidden backdoors.
  • Insecure hosting. A weak server setup or an infected neighbor on shared hosting can lead to infection.
  • Phishing. An admin is tricked into giving away a password. Our guide on how to spot a phishing email covers the signs.

What are the most important WordPress security steps?

Start with these seven steps, in this order. They cost little and cover the most common attacks.

Seven steps to secure a WordPress site
Start with these seven steps.

1. Keep WordPress, themes and plugins updated

Updates often contain security fixes. Take a backup, then update. Turn on automatic updates for minor WordPress releases (they are on by default) and, for plugins you trust, consider automatic updates too. Check the update screen at least weekly. If an update breaks something, our guide on the white screen of death shows how to recover.

2. Choose a secure host

Your host is part of your security. Look for a host that keeps PHP current, isolates accounts, offers a web application firewall, gives daily backups and supports free SSL. Cheap shared hosting is fine for many small sites if the host maintains the server well. Ask support what they do against malware and brute-force attacks.

3. Use strong, unique passwords and a password manager

Each account needs its own long password. A password manager creates and remembers them, so you do not reuse the same one. Check whether your email address appears in known breaches on the free service Have I Been Pwned and change any password that does. Do not keep a user called “admin”, and do not use your site name as a password.

4. Turn on two-factor authentication

Two-factor authentication (2FA) asks for a second proof, such as a code from an authenticator app, when you log in. A stolen password alone is then not enough. Many security plugins and dedicated 2FA plugins add it to WordPress. Our general guide on how to set up two-factor authentication explains the types.

5. Use HTTPS everywhere

HTTPS encrypts the data between your visitors and your site, including your login. Most hosts offer a free certificate. After you install it, set both the WordPress Address and Site Address under Settings, General to start with https, and redirect all http traffic to https.

6. Limit login attempts

Bots try thousands of passwords. A security plugin, your host or a firewall service can lock out an IP after several failed tries. You can also add a CAPTCHA to the login form, or protect the login page with a firewall rule.

7. Keep a tested backup

Nothing is fully safe, so plan for failure. A recent backup stored off the server makes recovery quick. Use the 3-2-1 rule from our backup guide.

How do you secure WordPress plugins and themes?

Install only what you need, from trusted sources, and keep it updated. Plugins and themes run code on your server, so each one is part of your attack surface.

  • Download from the official WordPress directories or from the developer’s own site.
  • Avoid “nulled” copies of paid products. They are a common way to spread malware.
  • Before installing, look at the active installations, the last updated date, the “tested up to” WordPress version and the support forum.
  • Delete plugins and themes you do not use. Deactivated code can still contain flaws.
  • Replace abandoned plugins that have not been updated for a long time.
  • Pick a maintained theme. Our article how to choose a WordPress theme shows what to check.

How should you manage WordPress users and roles?

Give every person the lowest role that lets them do their job, and remove accounts that are no longer needed. WordPress has these built-in roles:

Table of WordPress user roles and who should have each
Give each person the lowest role that lets them work.
  • Remove old accounts of former writers or freelancers.
  • Do not share one admin login between people.
  • Keep the number of administrators small, ideally one or two.
  • Use a separate email address for admin accounts that you do not publish.

What WordPress settings and files should you harden?

Several small settings in wp-config.php and on the server reduce risk. Back up your site before you edit anything, and change one thing at a time.

Disable the file editor

The built-in plugin and theme editor lets anyone with admin access change code from the dashboard. If an attacker gets in, it is a shortcut to take over the server. Add this line to wp-config.php:

define( 'DISALLOW_FILE_EDIT', true );

Use correct file permissions

A common setup is 755 for folders and 644 for files, and stricter permissions (such as 600 or 640) for wp-config.php. The official hardening guide explains the details and what your host may already set.

Protect wp-config.php

This file contains your database credentials and security keys. Keep it out of public folders if your host allows, and never share it in screenshots or forums. If it was exposed, change the database password and the secret keys.

Turn off directory listing

Without an index file, some servers show a list of files in a folder. Make sure this is disabled so that visitors cannot browse your uploads or plugin folders. Your host panel or an Options -Indexes rule in .htaccess does this on Apache.

Consider XML-RPC

The XML-RPC interface is used by some mobile apps and older tools. It can be a target for brute-force attacks. If you do not use it, ask your host or a security plugin to block it. Check first, because some plugins still depend on it.

Change the database table prefix?

Changing the default wp_ prefix is sometimes advised, but it gives little protection on its own. Do it on new sites only, and do not risk breaking an existing site for it.

Do you need a WordPress security plugin?

A security plugin helps, but it does not replace updates, strong logins and backups. It adds scanning, a firewall, login protection and alerts. Well-known options include Wordfence, Sucuri Security, Jetpack and Patchstack, among others. We have not run a comparison test for this article, so check each plugin’s current features, price and reviews on its own site.

Feature What it does Why it helps
Malware scan Checks files for known bad code Finds infections early
Firewall Blocks known attack patterns Stops attacks before they reach WordPress
Login protection Limits attempts, adds 2FA Stops password guessing
Activity log Records changes by users Helps find out what happened
Alerts Emails you about problems Shortens response time

Run only one security plugin at a time. Several firewalls and scanners together can conflict and slow the site, which can also make it feel broken, as covered in how to speed up a WordPress site.

How do you know if your WordPress site was hacked?

Typical signs are unknown admin users, new redirects, spam links, warnings from Google and files you did not add.

  • You are redirected to another site, especially from search results on mobile.
  • New admin users or changed passwords you did not make.
  • Spam pages or links to pills, casinos or fake shops appear in your content or in search results.
  • Your host suspends the account for malware or heavy resource use.
  • Google Search Console shows a security issue or a manual action.
  • The site becomes very slow or shows a blank page.

What should you do if your WordPress site is hacked?

Stay calm, take the site offline if needed, restore a clean backup, change every password and find how the attacker got in.

Five steps to recover a hacked WordPress site
The recovery order that avoids reinfection.
  1. Contact your host. They can often scan, isolate and restore.
  2. Back up the infected site for later analysis, then restore a clean backup from before the hack.
  3. Update everything and remove unused plugins and themes.
  4. Change all passwords: WordPress users, hosting, database, FTP, email, and regenerate the secret keys in wp-config.php.
  5. Remove unknown admin users and check for unknown files.
  6. Scan with a security plugin or a service.
  7. Check Google Search Console and request a review if Google flagged the site.
  8. Find the cause: an old plugin, a weak password or a pirated theme. Fix it, or it will happen again.

If you do not feel safe doing this alone, hire a professional incident response or cleanup service. A partial cleanup often leaves a backdoor.

WordPress security checklist

Copy this list and review it every month.

  • WordPress, themes and plugins are updated.
  • Unused plugins and themes are deleted.
  • All admin accounts use strong unique passwords and 2FA.
  • The site uses HTTPS.
  • User roles are correct and old accounts are removed.
  • DISALLOW_FILE_EDIT is set.
  • Login attempts are limited.
  • Backups run, go off-site, and a restore was tested.
  • A security scan ran this month.
  • Uptime monitoring and Search Console alerts are on.

Frequently asked questions

What is the biggest security risk for WordPress sites?

Outdated or vulnerable plugins and themes, followed by weak or reused passwords. Keeping everything updated and using two-factor login addresses both.

Is WordPress safe for a small business website?

Yes, when it is maintained. Use a reputable host, update regularly, limit users, use two-factor authentication and keep backups.

Do free WordPress themes and plugins have more risk?

Free items from the official directories are reviewed against basic rules and are not more risky by default. The danger comes from pirated copies of paid items and from abandoned plugins that no longer receive updates.

Should I hide my WordPress login page?

Changing the login URL can reduce bot noise, but it is not real protection by itself. Strong passwords, 2FA and login limits are more important.

How often should I check my site for malware?

A scan once a week is reasonable for most sites, and a scan after any suspicious event. Many security plugins and hosts scan automatically.

Can a hacked WordPress site hurt my SEO?

Yes. Spam pages, redirects and Google security warnings can remove your pages from search results. Clean the site fast and use Search Console to request a review.

What is the first thing to do after buying a new WordPress site?

Update everything, delete unused items, change all passwords, set up 2FA and backups, and remove sample users or content.

Sources and further reading

Summary

WordPress security is mostly routine. Update software, use strong logins with two-factor authentication, keep only trusted plugins, limit user roles, harden a few settings and keep tested backups. Review the checklist monthly, and a hack becomes a small, fixable event rather than a disaster.

About the author: Mo Abdlhamid works on websites and online business in Egypt and writes the guides on CMS Ideas. This guide is based on the official documentation and the sources linked above. We did not run new tests for it. Last reviewed December 1, 2026.

Leave a Comment