Setup & site building · Guide
How to Make Site in WordPress Secure (Step by Step)

Short answer
Keep WordPress core, plugins, themes and PHP updated, give every account a strong unique password with two-factor login, and delete plugins and themes you do not use. Then run the site on HTTPS, add a firewall with login limits, disable the file editor and keep off-site backups.
Key takeaways
- Outdated plugins and weak passwords cause most WordPress hacks.
- Two-factor login protects accounts even if a password leaks.
- Delete unused plugins and themes instead of just deactivating them.
- A firewall and login limits stop most automated attacks.
- Off-site backups are your recovery plan when everything else fails.
How do you make a WordPress site secure?
Keep everything updated, use strong unique passwords with two-factor login, remove what you do not use, run HTTPS, add a firewall and keep off-site backups.
WordPress core is maintained by a dedicated security team, and it is a solid base. Most hacked WordPress sites are broken into through outdated plugins, weak passwords or poor hosting, not core itself.
That is good news, because those are things you control. Our explainer on whether WordPress is secure covers the risk picture in more depth.
The steps below are ordered by impact. If you only have an hour, do the first five. The rest add layers that make an attack slower, louder or easier to recover from.
| Step | Effort | Impact |
|---|---|---|
| Update core, plugins and themes | Low | Very high |
| Strong passwords and two-factor login | Low | Very high |
| Remove unused plugins, themes and users | Low | High |
| Off-site backups | Medium | High (recovery) |
| HTTPS everywhere | Low | High |
| Firewall and login protection | Medium | High |
| Hardening settings in wp-config.php | Medium | Medium |
| Monitoring and audits | Medium | Medium |
Step 1: Keep WordPress, plugins and themes updated
Install updates promptly, because most WordPress break-ins exploit known flaws in plugins and themes that already have a fix.
Go to Dashboard, then Updates, at least once a week. WordPress applies minor core security releases automatically by default, but plugins and themes usually wait for you.
Turn on auto-updates for plugins you trust and that rarely break things. Our guide on enabling automatic updates for plugins shows how to do it per plugin.
Keep PHP current too. The PHP supported versions page lists which branches still get security fixes; anything past its end-of-life date should be upgraded through your host.
Before major updates, take a backup. If an update breaks the site, you can roll back instead of leaving the old, vulnerable version in place.
Step 2: Use strong passwords and two-factor login
Give every account a long, unique password from a password manager, and add two-factor authentication to every admin and editor account.
Stolen and guessed passwords are among the easiest ways in. A password manager makes long random passwords painless, and it stops you reusing the same password across sites.
Two-factor login adds a code from an app or a security key. Even if a password leaks, the attacker still cannot log in. Our guide on adding two-factor authentication to WordPress walks through the setup.
Avoid the username admin. It is the first name bots try. If you have one, create a new administrator, log in as that user, and delete the old account while assigning its content to the new one.
Change passwords right away if a team member leaves or a device is lost. Our guide on how to change a WordPress password covers every method.
Step 3: Limit who can do what
Give each person the lowest user role that lets them do their job, and remove accounts that are no longer needed.
WordPress has five main roles: Administrator, Editor, Author, Contributor and Subscriber. Only people who manage plugins, themes and settings need Administrator.
Writers rarely need more than Author. Clients who just want to read reports can often be Subscribers.
Review the user list every few months. Delete or downgrade old freelancer and agency accounts, and check for administrator accounts you did not create, which can be a sign of a past break-in.
Step 4: Remove what you do not use
Delete inactive plugins and themes, because deactivated code still sits on the server and can still be attacked.
A deactivated plugin is not a safe plugin. Its files can still be reached directly, and it stops getting your attention for updates.
Keep one default theme as a fallback and delete the rest. Our guide on removing unused plugins and themes safely shows how to clean up without breaking anything.
Never install nulled, pirated copies of premium plugins. They often carry hidden backdoors. Our look at whether nulled plugins are safe explains the risks.
Check plugin health before installing. Look for recent updates, active installs and how quickly the developer answers support threads on WordPress.org.
Step 5: Run the whole site on HTTPS
Install an SSL certificate and force every page to load over HTTPS so logins, cookies and form data are encrypted in transit.
Most hosts provide free certificates through Let's Encrypt and turn them on with one click. Our guide on installing an SSL certificate on WordPress covers the full process.
After installing, update the WordPress Address and Site Address under Settings, then General to start with https. Then fix any mixed content warnings.
HTTPS does not stop hackers on its own. It protects data in transit, which matters most on login pages, checkouts and contact forms.
Step 6: Add a firewall and login protection
Put a web application firewall in front of the site and limit repeated login attempts to block common automated attacks.
A firewall filters bad requests before they reach WordPress. It can run at the DNS level through a service such as a CDN, or as a plugin on the server.
Our guide on setting up a web application firewall compares the options.
Login protection limits how many failed attempts an address can make. That stops brute-force bots guessing passwords. See our guide to stopping brute-force attacks for the details.
If you do not use XML-RPC for apps or remote publishing, consider turning it off. It is another login endpoint that bots like to target.
Step 7: Harden wp-config.php and file permissions
Turn off the built-in file editor, set sensible file permissions and keep secret keys unique and private.
Add this line to wp-config.php, above the stop-editing comment, to remove the theme and plugin code editors from the dashboard:
define( 'DISALLOW_FILE_EDIT', true );
If an attacker gets into an admin account, the file editor lets them add code in seconds. Turning it off removes that easy path.
The official Hardening WordPress guide suggests file permissions of 644 for files and 755 for folders on most hosts, with tighter settings for wp-config.php where the server allows.
Make sure the security keys and salts in wp-config.php are set and unique. If you suspect a breach, generating new ones logs out every user at once.
Step 8: Keep off-site backups
Run automatic daily backups and store copies away from your hosting account, so you can recover even if the server itself is compromised.
A backup stored only on the same server can be deleted or infected along with the site. Use cloud storage, or a backup service that keeps its own copies.
Follow the 3-2-1 backup rule: three copies, two kinds of storage, one off-site. It sounds like overkill until the day you need it.
Test a restore now and then. A backup you have never restored is a hope, not a plan.
Step 9: Choose secure hosting
Pick a host that isolates accounts, patches its servers, supports current PHP and offers malware scanning and backups.
Cheap shared hosting is not always unsafe, but neighbouring sites on a poorly configured server can put yours at risk. Our guide on hardening WordPress on shared hosting covers the extra steps.
Managed WordPress hosts often add server-level firewalls, automatic updates and malware cleanup. Compare what is included before you choose a plan.
Check how the host handles incidents. Clear support for hacked sites and quick restores matter more than a long feature list.
Step 10: Monitor, scan and audit
Scan for malware regularly, log user activity and run a full security review a few times a year.
A scanner compares your files against clean copies and looks for known malware patterns. Our guide on how to scan WordPress for malware lists free and paid options.
Activity logs show who changed what and when. They help you spot strange logins or new admin accounts early.
For a complete check, follow our guide to running a WordPress security audit. The OWASP Top Ten is also a useful list of the web risks attackers target most.
What should you do if the site is already hacked?
Take the site offline or into maintenance mode, change every password, restore a clean backup or clean the files, then find and fix the way in.
Signs of a hack include spam pages in search results, redirects to strange sites, new admin users and warnings from your browser or host.
Do not just delete the obvious bad files. Attackers often leave backdoors, so cleanup must be thorough. Our guide on how to clean a hacked WordPress site walks through the full process.
After recovery, work through every step in this guide. Most repeat hacks happen because the original weak point, such as an old plugin, was never fixed.
The WordPress project explains its own approach to core security on its security page, which is worth reading if you want to know how fixes are handled.
Frequently asked questions
Is WordPress safe to use for a business website?
Yes, when it is maintained. WordPress core is actively secured by a dedicated team. Most problems come from outdated plugins, weak passwords and poor hosting, all of which you can fix with regular updates and good habits.
Do I need a security plugin for WordPress?
Not always, but most sites benefit from one. A good security plugin adds a firewall, login limits, two-factor login and malware scanning in one place. Some managed hosts provide these at server level instead.
How often should I update WordPress plugins?
Check at least weekly and install security updates as soon as they appear. Turn on automatic updates for trusted plugins, and take a backup before large updates so you can roll back if something breaks.
Does changing the login URL make WordPress secure?
It reduces bot noise but is not real protection on its own. Strong passwords, two-factor login and login attempt limits matter far more. Treat a custom login URL as a small extra, not a main defence.
What is the fastest way to improve WordPress security?
Update everything, delete unused plugins and themes, change weak passwords and turn on two-factor login for administrators. Those four steps take under an hour and close the most common ways in.
Sources
- Hardening WordPress WordPress Developer Resources
- Security WordPress.org
- Supported Versions PHP.net
- OWASP Top Ten OWASP Foundation
- Let's Encrypt Internet Security Research Group
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


