How to improve WordPress security: essential steps to protect your website
Key takeaways
- Updating WordPress core, themes and plugins is the most effective security step, because Patchstack research places most WordPress vulnerabilities in third-party plugins.
- The National Cyber Security Centre recommends multi-factor authentication and password managers such as 1Password or Bitwarden instead of forced password changes.
- The WordPress Developer Resources recommend 755 permissions for directories and 644 for files, with wp-config.php restricted further.
- Cloudflare, Wordfence and Sucuri add a web application firewall and malware scanning, and they work best on top of updates and strong logins.
- UpdraftPlus backups copied to Amazon S3 or Google Drive protect a WordPress website only when a restore to staging has been tested.
- Under UK GDPR and the Data Protection Act 2018, a compromised WordPress website holding personal data can become a breach the Information Commissioner’s Office must be told about.
The most effective way to improve WordPress security is to update WordPress, plugins and themes promptly, protect every login with multi-factor authentication and keep tested backups away from the web server. WordPress maintenance and security for business websites is mostly these habits, applied consistently, with Patchstack and the National Cyber Security Centre supplying the evidence for each one below.
WordPress runs a large share of the internet, so automated attack scripts target it by default. They look for the default wp-login.php page, weak passwords and plugins that Wordfence or Patchstack have already listed as vulnerable. Knowing when to bring in professional WordPress help is part of a solid security strategy.
For UK organisations the cost goes beyond lost weeks of work. A compromised website holding enquiry or customer data can breach UK GDPR and the Data Protection Act 2018, and the Information Commissioner’s Office (ICO) expects technical measures to be in place before an incident.
38.3%
of all websites run on WordPress, according to W3Techs usage data.
7,966
new vulnerabilities were found in the WordPress ecosystem in 2024, according to Patchstack.
96%
of those vulnerabilities were in plugins, with 4% in themes.
Sources: W3Techs and Patchstack State of WordPress Security.
The Patchstack figures explain why the sections below start with WordPress core and plugin updates before moving on to Google Authenticator logins, file permissions, UpdraftPlus backups and Cloudflare firewall rules.
Update WordPress core files consistently
Update WordPress core as soon as WordPress.org releases a security fix, because every release is published with patch notes that tell attackers exactly what was fixed. A website still on an old WordPress 6 release carries every fix issued since, and each one is a documented route in.
The WordPress.org security announcements list what each release patched, including cross-site scripting and SQL injection flaws. Major releases such as WordPress 6.8 add features, while minor releases carry the security and bug fixes.
The WordPress Developer Resources upgrade guide confirms that new installations since WordPress 5.6 update automatically for minor and major core releases, while older installations keep the earlier behaviour until an administrator changes it. Check the setting in Dashboard, Updates on any website built before WordPress 5.6.
Let minor security releases install automatically on brochure websites. WooCommerce stores and membership websites should test on a staging copy first, then apply the security fix within a day or two.
Managed hosts such as Kinsta and WP Engine offer staging environments, so the update can be tested and pushed live in the same working day.
Maintain current themes and plugins
Keeping themes and plugins current protects WordPress better than any other single measure, because Patchstack found that 96% of the vulnerabilities it recorded in 2024 were in plugins. WordPress core is reviewed by thousands of contributors on Make WordPress, while a form plugin maintained by one developer receives far less scrutiny.
Abandoned plugins are the worst case, because a known flaw is never fixed and automated scanners keep probing for it. The WordPress.org plugin directory shows when each plugin was last updated and which WordPress versions it was tested with, and the Plugin Review Team closes plugins with unresolved security issues.
Popular plugins such as Contact Form 7, Yoast SEO and WooCommerce receive fast security fixes because Patchstack, Wordfence and independent researchers report issues to their developers. An obscure plugin with a few hundred active installations rarely gets the same attention.
Review installed plugins each month in the WordPress Plugins screen and delete anything unmaintained, because a deactivated plugin still sits on the server. For critical features, a premium plugin from an established developer such as Gravity Forms or Advanced Custom Fields comes with support and a clear update history. Professional WordPress development handles this systematically instead of relying on someone remembering.
Deploy strong authentication systems
Strong authentication means every WordPress account has a unique password, a second factor and only the access it needs, because WordPress allows unlimited login attempts from any IP address by default. Brute-force tools such as Hydra and WPScan try thousands of username and password pairs, and a company name followed by a year is among the first guesses.
The National Cyber Security Centre (NCSC) has changed its advice. Its password guidance for system owners says regular password expiry harms rather than improves security, so a 90-day change cycle is no longer recommended. For staff, the NCSC suggests three random words as a long password that is easy to remember.
Every WordPress administrator, editor and shop manager account needs these controls:
- Unique passwords generated and stored in 1Password, Bitwarden or Apple Passwords
- Multi-factor authentication through Google Authenticator or Microsoft Authenticator, following the NCSC multi-factor authentication guidance
- The official Two-Factor plugin from the WordPress.org directory, or the equivalent in Wordfence Login Security
- Administrator rights limited to named staff, with accounts removed on the day someone leaves
Organisations using Microsoft Entra ID, Okta or Google Workspace can connect WordPress to their existing single sign-on through SAML or OpenID Connect, which centralises access control and makes removing a leaver simpler.
Configure secure file permissions
Secure file permissions mean the Apache or Nginx web server can read WordPress files while only the owning account can change them. Wrong permissions let an attacker edit core files, inject PHP backdoors or read database credentials from wp-config.php.
The WordPress Developer Resources hardening guide recommends 755 for directories and 644 for files. A website with 777 permissions on every file lets any account on the shared server change anything, including attackers who compromised a neighbouring website.
| File Type | Permission | Purpose |
|---|---|---|
| Directories | 755 | Read and execute access for all, write for owner |
| PHP files | 644 | Read access for all, write for owner only |
| wp-config.php | 600 | Read and write for owner only |
| .htaccess | 644 | Read access for web server configuration |
Many managed hosts such as WP Engine set sensible permissions by default, and plugin installs, theme updates or manual uploads over SFTP with FileZilla can change them. Check permissions each quarter in cPanel or your SFTP client, and again after any major WordPress update.
The same hardening guide describes the DISALLOW_FILE_EDIT constant for wp-config.php, which removes the Theme File Editor and Plugin File Editor from the WordPress dashboard. It does not stop uploads, but it closes one easy route from a stolen administrator login to running PHP code.
Source themes and plugins from trusted repositories
Source themes and plugins from the WordPress.org directories, ThemeForest or the developer’s own licensed shop, because each applies review that random download websites do not. The WordPress.org Plugin Review Team checks every plugin against the detailed plugin guidelines before it is listed.
Nulled copies of Elementor Pro, Divi or Gravity Forms are tempting for agencies running several websites. They regularly contain backdoors that create hidden administrator accounts, and using them breaks the developer’s licence terms.
- Download from WordPress.org or the developer’s own licensed shop.
- Check the last updated date and the support forum replies.
- Confirm compatibility with your current WordPress and PHP versions.
- Install nulled or cracked premium themes and plugins.
- Keep plugins that WordPress.org has closed or abandoned.
- Treat a high install count as a guarantee of maintenance.
A high install count on WordPress.org usually points to better maintenance, but it is not a guarantee. Recent threads in the plugin’s support forum show how quickly the developer answers bug and security reports.
Prevent brute-force login attacks
Limiting login attempts is the most direct way to stop brute-force attacks, and Wordfence, Jetpack and Solid Security all do it without custom code. The WordPress Developer Resources describe the wider options in their brute force attack guide.
Configure Wordfence or your chosen security plugin with these settings:
- A lockout after a few failed attempts from one IP address
- Longer lockouts for repeated failures
- Email notifications to the website owner for suspicious activity
- An allowlist for the office IP address so staff are not locked out
- Usernames other than admin, administrator or the domain name
Moving the default wp-admin login URL with a plugin such as WPS Hide Login cuts automated scanning and log noise, though it does not stop a determined attacker. Technology companies benefit from combining it with Google Authenticator, since they face more targeted attention.
Establish backup procedures
An effective backup strategy keeps complete, recent copies of the MySQL database and the wp-content files in a location away from the web server, and proves them by restoring. Plugins such as UpdraftPlus and BackupBuddy can stop working without any error message, and the first sign is a restore that finds the latest copy is weeks old.
The WordPress Developer Resources backup guide covers both the database and the files, and the NCSC advice to always back up your most important data applies equally to a business website.
A sound strategy includes these components:
- Daily database backups through UpdraftPlus or your host’s snapshot tool
- Regular full backups of WordPress core, themes and the uploads folder
- Off-site storage in Amazon S3, Google Drive or Backblaze B2
- Restore testing on a staging copy in Local or your host’s staging tool
- Retention long enough to roll back a problem noticed weeks later
UpdraftPlus automates most of this reliably. Healthcare organisations and other regulated sectors must also confirm that backup storage meets UK GDPR, which the ICO security guidance sets out.
Testing a restore matters more than backup frequency, because an untested backup is only a file taking up storage. Run a restore on a staging website each quarter to prove the copy works.
Secure database configuration
Securing the MySQL or MariaDB database means changing the defaults that attack scripts expect and limiting what the WordPress database user may do. Most WordPress installs use the default wp_ table prefix, and the same hardening guide notes that many published SQL injection attacks assume it.
Compromised websites often show evidence of attackers using SQL injection to read the wp_users table. The OWASP Foundation explains how SQL injection works, and a custom prefix forces the attacker to find table names first.
These database changes are worth making:
- A unique table prefix instead of wp_ on new WordPress installations
- A long random database password stored only in wp-config.php
- A MySQL user limited to the SELECT, INSERT, UPDATE and DELETE privileges WordPress needs day to day
- Encrypted connections to MySQL or MariaDB where the host supports TLS
- Regular clean-up of spam comments and old post revisions with WP-CLI or WP-Optimize
Changing the prefix on an existing website alters every table name, so take a full UpdraftPlus backup first and test the change on staging. Skipping the backup is the most common way this change fails.
Deploy firewall and SSL protection
A web application firewall filters malicious requests before they reach WordPress, and an SSL certificate encrypts traffic between the visitor’s browser and the server. Cloudflare’s free plan proxies the website, and its web application firewall blocks common attack patterns including SQL injection and cross-site scripting.
Google has treated HTTPS as a ranking signal since its August 2014 announcement. Let’s Encrypt issues free certificates that renew automatically through the ACME protocol, and cPanel, Plesk and Cloudflare enable them in a few clicks.
Firewall rules in Cloudflare or Wordfence should block:
- Requests from IP addresses on known botnet and Tor exit node lists
- Suspicious user agents and automated scrapers
- Direct requests to wp-config.php, xmlrpc.php and other sensitive files
- Countries outside your target markets where that is relevant
Organisations handling sensitive client data may need a paid Cloudflare plan, with compliance reporting and detailed logs. Managed hosting services typically include server-level protection, and web application projects with customer logins need it from day one.
Implement active malware scanning
Active malware scanning compares WordPress files with known malware signatures every day, so an infection is found within hours. Without it, slow pages and visitor complaints are often the first sign that malicious code has been injecting spam links into Google search results or mining cryptocurrency on the server.
Wordfence and Sucuri both scan for unauthorised changes to WordPress core files and known malware, and Google Search Console reports hacked content warnings through its Security Issues report. Manual file checking is impractical on a website with thousands of files, and regular monitoring also looks for:
- Outbound connections from PHP to unknown command and control servers
- New administrator accounts nobody created in Users
- Theme and plugin files containing injected base64 or eval code
- Hidden backdoor files in wp-content/uploads
- Unusual wp_options entries or injected spam content
Schedule Wordfence scans for low-traffic periods and set up immediate email alerts. WooCommerce stores that process card payments through Stripe or PayPal should consider a managed monitoring service where a person reviews the scan results.
Telling genuine threats from false positives takes experience, so treat every alert seriously until it has been investigated. The NCSC Cyber Essentials scheme is a useful baseline for the patching, access control and malware protection controls a business website should meet.
FAQs
Do I need a security plugin if my host already has a firewall?
A server-level firewall blocks malicious traffic before it reaches WordPress, while a plugin such as Wordfence or Sucuri scans files, monitors logins and spots unauthorised changes inside the installation. The two cover different layers, so most business websites benefit from both.
Is it safe to change the wp-admin login URL?
Moving the login page with a plugin such as WPS Hide Login is safe when you record the new address and test it before logging out. It reduces automated scanning noise but does not replace login limits and multi-factor authentication.
What should I do first if my WordPress website has been hacked?
Take the website offline or put it into maintenance mode, change every administrator and hosting password and restore a clean backup taken before the infection. Then update everything, scan with Wordfence or Sucuri and check whether personal data was exposed, because the ICO may need to be told.
How do I check whether a WordPress plugin has known vulnerabilities?
Search the plugin name in the Patchstack vulnerability database or the Wordfence Intelligence database, which list disclosed flaws with the versions affected. Compare the installed version with the fixed version and update, or remove the plugin if no fix exists.