WordPress Security Basics
WordPress security basics means keeping core, themes and plugins updated, using strong unique passwords with two-factor authentication, limiting login attempts, setting correct file permissions, and keeping a tested backup. Most successful attacks exploit an outdated plugin or a weak, reused password rather than a flaw in WordPress itself. A handful of consistent habits blocks the large majority of automated attacks.
Why WordPress sites are a common target
WordPress runs a very large share of the websites on the internet, and that popularity is exactly why automated attacks target it so often. Most attacks are not a person manually trying to break into one specific site; they are scripts scanning millions of domains for a known, unpatched vulnerability in a particular plugin or theme version. A site does not need to be famous or high-traffic to be scanned, it only needs to be reachable and running outdated software.
The core security checklist
- Keep everything updated: WordPress core, themes and plugins, since most real-world compromises trace back to a known, already-patched vulnerability.
- Remove what you do not use: inactive plugins and themes can still be exploited even when deactivated, so delete them instead of leaving them installed.
- Use strong, unique passwords for every admin account, ideally from a password manager, and never reuse a password from another site.
- Turn on two-factor authentication for all accounts with publishing or admin access.
- Limit login attempts so a script cannot guess passwords thousands of times in a row.
- Give each user the lowest role that lets them do their job; not every contributor needs administrator access.
- Keep PHP on a current, supported version, since old PHP versions stop receiving security fixes.
File permissions and server-level hardening
WordPress files should be writable only where necessary. Overly permissive folders (sometimes left at 777) let an attacker who finds any way in write new files anywhere on the site. Reasonable defaults for most shared and VPS setups are:
find /path/to/wordpress -type d -exec chmod 755 {} \;
find /path/to/wordpress -type f -exec chmod 644 {} \;
chmod 600 wp-config.php
Adding define('DISALLOW_FILE_EDIT', true); to wp-config.php also removes the theme and plugin file editor from the dashboard, so a compromised admin account cannot be used to insert malicious code straight through the browser.
Backups and a security plugin
A tested, offsite backup is the safety net for every other step on this list. If everything else fails, a recent backup stored away from the live server lets you restore a clean copy instead of negotiating with an attacker or rebuilding from scratch. A security plugin or a host-level web application firewall adds another layer by blocking common attack patterns and scanning files for unexpected changes, which often catches an infection before you would notice it yourself.
If you think your site has been hacked
- Put the site in maintenance mode or take it offline temporarily so visitors are not served malicious content.
- Scan for malware with a security plugin or ask your host for a scan; many hosts offer this as part of support.
- Check for unfamiliar admin accounts, unknown files, and unexpected changes to core files.
- Restore from a backup taken before the infection appeared, rather than trying to manually remove every trace.
- Change every password and secret key, including database credentials and the WordPress security keys in
wp-config.php. - Update everything before bringing the site back online, since the same unpatched flaw will otherwise let the attacker back in.
Frequently asked questions
Is WordPress itself insecure?
The core WordPress software is actively maintained and security issues are patched quickly. Most real-world compromises come from outdated plugins or themes, weak passwords, or an insecure hosting environment, not a flaw in WordPress core.
Do I need a security plugin if my host already has a firewall?
A host-level firewall blocks a lot of automated traffic before it reaches your site, but a security plugin adds WordPress-specific checks such as file change monitoring and login protection. Using both covers more ground than either alone.
How often should I update WordPress?
Apply security updates as soon as they are available, ideally within a few days, since attackers often target sites quickly after a vulnerability is publicly disclosed. Many hosts and plugins support automatic updates for minor releases.
Does hiding or renaming wp-login.php actually stop attacks?
It can reduce the volume of automated login attempts hitting that specific URL, but it is not a real security control on its own. Strong passwords, two-factor authentication and login attempt limits matter far more than hiding the login page.
What is the single most important WordPress security step?
Keeping WordPress core, themes and plugins updated prevents more real attacks than any other single step, since most compromises exploit a vulnerability that was already patched before the site was attacked.
How do I know if my WordPress site has been hacked?
Common signs include unfamiliar admin users, strange redirects, new files you did not add, search engine warnings, or a sudden drop in traffic. A malware scanner or your host's security tools can confirm it faster than checking manually.
Related topics
- What Is WordPress? WordPress Hosting
- Two-Factor Authentication (2FA) for Hosting Accounts Security & SSL
- File Permissions and chmod Explained FTP & File Management
- What Is a VPS (Virtual Private Server)? VPS & Cloud
- What Is a WAF (Web Application Firewall)? Security & SSL