Home » Blog » Security » Common WordPress Security Mistakes That Get Websites Hacked
Security

Common WordPress Security Mistakes That Get Websites Hacked

WordPress security dashboard with a protection shield, two-factor authentication toggles and a list of blocked login attempts

Most hacked WordPress sites were not hacked by a genius. They were hacked by a script that tried the same WordPress security mistakes on a million sites and found a door left open on yours. After twelve years of building and maintaining WordPress sites – and cleaning up a fair number after the fact – I can tell you that the same fifteen mistakes account for almost every incident I have seen.

The good news: each of them has a fix you can apply today, and most fixes take minutes. This guide lists the mistakes in the order they are exploited in the real world, explains how each one is used against you, and gives the exact fix – with code where code is the answer. At the end there is a hardening checklist, a recovery plan for the day it does go wrong, and a short FAQ.

One framing note before we start: security is not a plugin you install. It is a handful of habits plus a layered setup. Any one layer can fail; the combination rarely does.

Table of contents

How WordPress sites actually get hacked

WordPress powers over 40% of the web, so attackers automate. Bots scan for known vulnerable plugin versions, try leaked password lists against wp-login.php and XML-RPC, upload a PHP “web shell” through any insecure upload form, and then use the site to send spam, host phishing pages, redirect visitors to scams or mine your SEO. The damage: blacklisting by Google (“this site may be hacked”), lost rankings, lost customers, and days of cleanup.

Diagram of how WordPress websites get hacked: bots exploiting vulnerable plugins, weak passwords, XML-RPC brute force, insecure uploads and hosting misconfiguration
Where compromises start: vulnerable plugins and themes first, weak credentials second – almost never WordPress core.

Industry reports year after year say the same thing: the overwhelming majority of WordPress compromises come from vulnerable plugins/themes, and most of the rest from weak credentials. Core WordPress itself is rarely the entry point. Keep that in mind as you read – the fixes are not exotic.

Mistake 1 – Outdated plugins, themes and core

How it is used against you: a vulnerability is published, a patch is released, and within hours bots scan for sites still on the old version. If you update “when I get to it”, you are on the list.

The fix:

  • Enable automatic updates for core (minor releases are on by default; enable major too unless you have a reason not to) and for plugins/themes you trust – WordPress has per-plugin auto-update toggles.
  • For business-critical sites, update on staging first, then production, on a weekly schedule – never “someday”.
  • Subscribe to vulnerability notices (Wordfence or Patchstack feeds) so a critical plugin CVE does not wait for your weekly slot.
  • Delete inactive plugins and themes; they are still code on disk that can be exploited.

Mistake 2 – Weak passwords and no two-factor authentication

How it is used: credential-stuffing bots try millions of email/password pairs from old breaches. If any editor reuses a password, the bot is in – and then it installs a backdoor plugin as that user.

The fix: enforce long unique passwords (a password manager makes this painless), enable two-factor authentication for every account that can log in (Wordfence Login Security, WP 2FA, or your security suite), and require it for administrators. This single change stops the majority of credential attacks cold.

Mistake 3 – “admin” usernames and too many administrators

How it is used: half of all brute-force attempts guess the username “admin”. And every extra administrator is another account that can be phished or breached.

The fix: no account named admin (create a new admin, reassign content, delete the old one); one or two administrators only; editors get Editor, shop staff get Shop Manager, the SEO freelancer gets a limited role – least privilege, always. Review users quarterly and remove people who left.

Mistake 4 – Nulled and abandoned plugins/themes

How it is used: “free” copies of premium plugins routinely contain backdoors – you install the attacker yourself. Abandoned plugins (no update in two years) never get patched when a flaw is found.

The fix: only install from the official repository or directly from the developer; check the “last updated” date and the support forum before installing anything; replace abandoned plugins. If a feature is small, a few lines of custom code are safer than a plugin that nobody maintains – this is a big part of why I prefer purpose-built plugins on client sites.

Mistake 5 – Unlimited login attempts and an exposed login URL

How it is used: with no limit, a bot can try 10,000 passwords an hour against /wp-login.php.

The fix: limit login attempts (lock out after 5 failures; Limit Login Attempts Reloaded, Wordfence or your host’s protection), add a CAPTCHA or Cloudflare Turnstile on the login form, and optionally move the login URL (security through obscurity is not a defence on its own, but it cuts bot noise by 90%). Consider restricting /wp-admin to your IPs if your team is small and static.

# .htaccess - block wp-login.php except from your IPs (Apache)
<Files wp-login.php>
  Require ip 203.0.113.10 198.51.100.0/24
</Files>

Mistake 6 – XML-RPC and the REST API wide open

How it is used: xmlrpc.php allows hundreds of login attempts in a single request (system.multicall) and is used for DDoS amplification. The REST API’s user endpoint lists your usernames to anyone.

The fix: disable XML-RPC unless you use the mobile app or Jetpack features that need it; restrict the users REST endpoint for logged-out visitors.

// functions.php or a small mu-plugin
add_filter( 'xmlrpc_enabled', '__return_false' );

// hide the public user list (/wp-json/wp/v2/users) from visitors
add_filter( 'rest_endpoints', function ( $endpoints ) {
  if ( ! is_user_logged_in() ) {
    unset( $endpoints['/wp/v2/users'], $endpoints['/wp/v2/users/(?P<id>[\d]+)'] );
  }
  return $endpoints;
} );

Mistake 7 – No backups (or backups you have never restored)

How it is used: it is not an attack – it is what turns an incident into a disaster. Without a clean backup, a hacked site means rebuilding from scratch or paying for a cleanup you cannot verify.

The fix: automatic daily backups (files + database) stored off the web server (S3, Dropbox, Google Drive, the host’s separate backup system), kept for 30 days, and – this is the part everyone skips – tested by actually restoring to staging once a quarter. UpdraftPlus, BlogVault, Jetpack Backup or your host’s service all work; the off-site and restore-tested parts are what matter.

Mistake 8 – Cheap shared hosting and bad file permissions

How it is used: on badly isolated shared hosting, a compromised neighbour can reach your files; world-writable directories let any script write PHP into your uploads folder.

The fix: hosting with proper account isolation (PHP-FPM per user, CageFS/containers), file permissions 644 for files and 755 for directories, wp-config.php at 600 or 640, no PHP execution in /uploads, and DISALLOW_FILE_EDIT so the theme/plugin editor in wp-admin is gone.

# uploads/.htaccess - never execute PHP inside the uploads folder
<FilesMatch "\.(php|phtml|php\d)$">
  Require all denied
</FilesMatch>

// wp-config.php
define( 'DISALLOW_FILE_EDIT', true );

Mistake 9 – No firewall and no malware scanning

How it is used: without a web application firewall, every probe reaches WordPress; without scanning, a backdoor sits quietly for months.

The fix: a WAF in front of the site (Cloudflare’s free plan with its managed rules, plus or instead of a plugin firewall like Wordfence / Solid Security / the host’s WAF), and a scheduled malware scan with file-integrity checks against the official WordPress/plugin checksums. Alerts to an email you read.

Mistake 10 – Leaking information: version numbers, user lists, debug mode

How it is used: the generator meta tag, readme files and ?author=1 tell bots exactly which versions and usernames to attack. WP_DEBUG on production prints file paths and queries to visitors.

The fix: remove the generator tag, block author enumeration, delete readme.html and license.txt after installs, turn debug display off on production, and hide plugin versions where you can. None of this stops a determined attacker, but it removes you from the easy-target lists, which is where most attacks come from.

remove_action( 'wp_head', 'wp_generator' );

// stop /?author=N username enumeration
add_action( 'template_redirect', function () {
  if ( is_author() && ! is_user_logged_in() && isset( $_GET['author'] ) ) {
    wp_redirect( home_url(), 301 ); exit;
  }
} );

// wp-config.php (production)
define( 'WP_DEBUG', false );
define( 'WP_DEBUG_DISPLAY', false );

Mistake 11 – Missing security headers and a sloppy HTTPS setup

How it is used: without HSTS a visitor can be downgraded to HTTP; without a Content-Security-Policy an injected script runs freely; without X-Frame-Options your login page can be framed for clickjacking.

The fix: force HTTPS everywhere (301 from http, no mixed content), then send the standard headers: Strict-Transport-Security, Content-Security-Policy (start with a report-only policy and tighten), X-Content-Type-Options: nosniff, X-Frame-Options: SAMEORIGIN, Referrer-Policy, Permissions-Policy. Test on securityheaders.com – an A grade is achievable on any WordPress site in an afternoon (my own theme sends all of them from one function). The CSP is the one that takes care: WordPress, page builders and SEO plugins use inline scripts, so start permissive and tighten with the browser console open.

Five-layer WordPress security hardening stack: edge firewall, server, login and users, code updates, backups and monitoring
Defence in depth: five layers, any one of which can fail without the site being compromised.

Mistake 12 – Insecure forms and uploads

How it is used: a contact form that accepts file uploads without type checks is a PHP shell waiting to happen; forms without nonces and sanitisation are a playground for injection and spam.

The fix: restrict upload types and sizes, store uploads outside the web root or behind a handler, validate on the server (never trust the browser), use nonces and capability checks on every form handler, sanitise and escape everything, and rate-limit submissions. If you build custom forms or AJAX endpoints, this is non-negotiable – the same rules apply to the chat endpoints I describe in my AI chatbot guide.

Mistake 13 – Old PHP and database versions

How it is used: PHP 7.x no longer receives security fixes; known interpreter bugs stay exploitable forever.

The fix: PHP 8.2 or 8.3 (also 10-30% faster), current MySQL/MariaDB, and a host that rolls these out. Check Tools > Site Health; if your host still defaults to PHP 7.4, that is a sign about the host.

Mistake 14 – No staging, no monitoring, no logs

How it is used: changes go straight to production, break things, and get “fixed” by disabling security features; nobody notices a compromise until Google does.

The fix: a staging site for updates and changes; uptime monitoring (a free ping service is enough); an activity log plugin (WP Activity Log / Simple History) so you can see who changed what; file-change alerts from your scanner; and Search Console’s security issues report checked monthly.

Mistake 15 – Trusting plugins with too much power

How it is used: some plugins ask for or implement far more than they need – remote code execution “features”, file managers inside wp-admin, builders that execute arbitrary PHP from the editor, plugins that store API keys in plain options exported with the database.

The fix: avoid file-manager and “code snippet” plugins on production; keep API keys in wp-config.php or the host’s secrets manager; prefer fewer, well-maintained plugins; and when you need something specific, have it built properly. Every plugin is code you run as your site – choose like it.

WooCommerce and client sites: the extra layer

Stores and agency-managed sites carry more than content – they carry customer data, payment flows and someone else’s reputation. A few additions to the list above:

  • Payments: never store card data in WordPress; use hosted or tokenised gateways (Stripe, PayPal, Mollie, Razorpay) so PCI scope stays with the provider. Keep gateway webhooks on HTTPS with signature verification, and rotate API keys when staff change.
  • Customer data minimisation: collect only what checkout needs, anonymise old orders after your retention period, restrict who can export customers, and make sure backups containing personal data are encrypted and access-limited.
  • Admin hygiene for stores: Shop Manager role for staff (not Administrator), 2FA for every account, activity log on order and product changes, and alerts on refund/coupon bursts – a compromised staff account is often noticed first through odd refunds.
  • Extensions: payment, shipping and marketing plugins connect to external services; keep them updated on the day a patch lands, and remove the ones you stopped using (they keep their API keys in the database).
  • Uptime and integrity monitoring that pings you within minutes – for a store, an hour of “checkout broken” is real money.

For agencies handing sites to clients: deliver a one-page security sheet with the handover – who has which role, where backups go, how to reach the firewall, what the update schedule is and who to call. Most “the client’s site got hacked” stories start with an unmanaged site and no agreed owner; a small maintenance plan prevents that and is easy to sell, because the client is already paying for hosting they do not understand. I build that routine into every maintenance agreement – updates on staging, backups tested quarterly, scans, and a monthly report the client can read.

Security without slowing the site down

A common worry: “won’t all these plugins make the site slow?” They can, if you stack three security suites. The fast approach: do the hardening at the server and configuration level (headers, permissions, PHP version, login limits via the host or a lightweight plugin), put the firewall at the edge (Cloudflare) where it costs your server nothing, and keep only one scanner plugin that runs on a schedule rather than on every page load. Security headers are a single response header block; 2FA adds nothing to front-end weight; limiting login attempts runs only on the login page. Done this way, a hardened site is measurably no slower than an unprotected one – my own site sends the full header set and scores 95+ on mobile. If your current security setup costs you PageSpeed points, the setup is wrong, not the idea.

The 30-minute hardening checklist

  1. Update everything; enable auto-updates; delete inactive plugins/themes.
  2. Strong unique passwords + 2FA for all users; no “admin” user; least-privilege roles.
  3. Limit login attempts; CAPTCHA/Turnstile on login; consider IP restriction for wp-admin.
  4. Disable XML-RPC; hide the REST users endpoint; block author enumeration; remove generator tag.
  5. Daily off-site backups, 30-day retention, restore tested.
  6. Proper hosting isolation; permissions 644/755; wp-config 600; no PHP in uploads; DISALLOW_FILE_EDIT.
  7. WAF (Cloudflare and/or plugin) + scheduled malware and integrity scans with alerts.
  8. HTTPS everywhere + HSTS, CSP, nosniff, X-Frame-Options, Referrer-Policy, Permissions-Policy.
  9. Forms: validation, nonces, upload restrictions, rate limits.
  10. PHP 8.2+, current database; debug off on production.
  11. Staging, uptime monitoring, activity log, monthly Search Console check.

If you do only three things: updates, 2FA and off-site backups. They prevent or undo the large majority of incidents.

Auditing a site you inherited

Agencies and new owners often take over a WordPress site with no history. Before hardening, audit: export the user list and remove or downgrade unknown accounts; list plugins and themes with their last-update dates; compare core files against the official checksums (wp core verify-checksums with WP-CLI, or a scanner); look into wp-content/uploads and the site root for PHP files that should not be there; read wp-config.php and .htaccess for unexpected lines; check scheduled events and must-use plugins; and review the hosting account for extra FTP users or cron jobs. Only then run the checklist – otherwise you are locking the doors while someone is already inside. Half an hour of auditing has saved me from “hardening” sites that were already compromised more than once.

What to do if your WordPress site is hacked

  1. Contain: put the site in maintenance mode or take it offline; change all passwords (WordPress, hosting, database, FTP/SFTP, email); revoke API keys.
  2. Assess: scan files and database; check for unknown admin users, modified core files, new PHP files in uploads, scheduled tasks, and injected content/redirects.
  3. Restore or clean: the cleanest path is restoring a known-good backup from before the compromise, then updating everything and closing the hole. If you must clean in place, replace core/plugins/themes with fresh copies and inspect uploads, wp-config and .htaccess line by line.
  4. Close the door: identify the entry point (logs, vulnerability notices) and fix it – otherwise you will be back here in a week.
  5. Recover reputation: request a Google review in Search Console if flagged, check blacklists, inform customers if data may be affected (legal obligations vary).
  6. Harden: run the checklist above; add monitoring so you know within minutes next time.

This is work I do as part of WordPress maintenance & security – cleanup when needed, and more importantly the routine that makes it unnecessary.

Prefer someone to handle this for you?

A hardened, monitored WordPress site is a fixed-price job, and ongoing care is a small monthly plan. Tell me about your site and I will reply within 24 hours with a security review and a quote – no obligation.

Frequently asked questions

What is the most common way WordPress sites get hacked?

Vulnerable plugins and themes – usually outdated or abandoned ones – followed by weak or reused passwords without two-factor authentication. Core WordPress is rarely the entry point.

Is a security plugin enough to protect my WordPress site?

No. A security plugin adds a firewall, scanning and login protection, which helps – but it cannot fix outdated code, weak passwords, bad hosting or missing backups. Security is layered: updates, 2FA, backups, hosting, firewall, headers and habits.

Do I need to change the WordPress login URL?

It is optional. It reduces bot noise but does not stop a targeted attacker. Limiting login attempts, 2FA and a CAPTCHA matter more; changing the URL is a nice extra.

How often should I update WordPress plugins?

Weekly at minimum, with automatic updates enabled for trusted plugins and immediate updates for published critical vulnerabilities. Test on staging for business-critical sites.

How do I know if my WordPress site has been hacked?

Signs include unknown admin users, new files in uploads or the root, redirects to other sites, spam pages in Google results, Search Console security warnings, slower performance and outbound spam email. A malware and file-integrity scan confirms it.

Should I disable XML-RPC in WordPress?

Yes, unless you specifically use the WordPress mobile app, Jetpack features or a remote publishing tool that needs it. It is a common brute-force and DDoS vector with little benefit for most sites.

What security headers should a WordPress site send?

Strict-Transport-Security, Content-Security-Policy, X-Content-Type-Options, X-Frame-Options (or CSP frame-ancestors), Referrer-Policy and Permissions-Policy. Test with securityheaders.com and aim for an A.

Vishal Bhisara

Written by Vishal Bhisara

Full Stack WordPress Developer & AI Solutions Expert with 12+ years of experience and 500+ projects delivered worldwide. I help businesses and agencies build fast, secure, SEO-ready websites - custom themes, plugins, WooCommerce stores, and AI automation that actually grows revenue. Based in Bhavnagar, India, working with clients across the globe. More about me →

Need Expert WordPress Support?

Reading great content is the first step. Implementing the right strategy is what delivers results. If you need professional help with your WordPress website, WooCommerce store, AI automation, or custom development project, I'm here to help.

Have a Project in Mind? Let's Make It Happen.

Start a Project
Vishal Bhisara
Vishal Bhisara Your WordPress & AI partner
Get a Free QuoteGet a Free Quote