How to secure a WordPress site
Secure WordPress by keeping core, plugins and themes updated, using HTTPS and strong unique accounts, testing off-site backups, limiting file access and monitoring changes. The manual route is fine for small sites, but a security plugin saves time on scans, firewall rules and ongoing checks.
- 01Update every WordPress component
- 02Protect accounts and logins
- 03Use HTTPS and secure hosting
- 04Make backups you can restore
- 05Limit file access and editing
- 06Scan and monitor the site
Update every WordPress component
Update WordPress core, active plugins and active themes from the dashboard. Remove plugins and themes you do not use rather than leaving them installed. Download WordPress only from the official WordPress project, and check that updates do not break forms, payments or scheduled jobs.
Do not update everything blindly on a busy production site. Take a backup first and update during a quiet period. If an update causes a fatal error, restore the backup or ask your host to help roll back the affected component.
Protect accounts and logins
Give each person their own account, remove old users, and use a unique password of at least 20 characters for every administrator. Reduce permissions: most editors do not need administrator access. Enable two-step authentication through a trusted authentication solution, and secure your hosting, database and email accounts as well as WordPress.
Do not rely on hiding the login URL or changing the administrator username as your main defence. A stolen administrator session can bypass those tricks.
Use HTTPS and secure hosting
Enable an SSL certificate at your host, make the site load at its HTTPS address, and check that images, scripts and forms do not still load over HTTP. In WordPress, confirm the site and home addresses use HTTPS. If you manage the server, require HTTPS for the dashboard and logins with define( 'FORCE_SSL_ADMIN', true ); in wp-config.php.
Ask your host whether it provides a web application firewall, malware scanning, activity logs and automatic backups. Server-level filtering can block malicious requests before WordPress loads, but misconfigured rules can also block legitimate administrators, so keep a way to disable or adjust them.
Make backups you can restore
Back up the database and WordPress files on a schedule that matches how often the site changes. Keep copies outside the hosting account, protect them from public web access, and test restoring one before you need it. A backup that has never been restored is only an assumption.
Do not fix a backup-folder permission warning by casually setting directories to 0777. Publicly reachable backup files can expose credentials, and a restore from an already-infected backup can put the compromise straight back. Check the backup path and ask your host or plugin support for the correct ownership and permissions instead.
Limit file access and editing
Use the least permissive file permissions that work with your host. A common starting point is files at 644 and directories at 755, but ownership and server configuration matter more than copying numbers from a checklist. Never make the whole WordPress directory writable just to silence an error.
Disable the built-in dashboard editor by adding define( 'DISALLOW_FILE_EDIT', true ); to wp-config.php. This reduces what an attacker can do after gaining an administrator account, but it does not stop malicious uploads or repair an already-compromised site. Keep this file backed up before editing it, and place the setting before the line that says WordPress has stopped editing.
Scan and monitor the site
Review administrator accounts, recently installed extensions, unexpected files and hosting access logs. Watch for changed core or plugin files, new redirects, spam pages, unfamiliar scheduled tasks and unexplained administrator logins. If the site is already showing suspicious changes, do not simply reinstall WordPress and carry on; identify and remove the vulnerable entry point first.
The manual route can protect a small, stable site, but it depends on you remembering recurring scans, login protection, firewall rules and file checks. For the fast route, use Security Ninja Premium to combine vulnerability scans, firewall protection, brute-force login controls, file monitoring, scheduled scans, logging and security recommendations in one WordPress plugin. Review its alerts rather than enabling every aggressive rule without checking your checkout, forms and admin access.
Let Security Ninja Premium do it
Combines vulnerability scans, firewall protection, file monitoring, and login hardening for all-in-one WordPress security.
Sources
- developer.wordpress.org /advanced-administration/security/hardening/?utm_source=open…
- wordpress.org /support/topic/you-have-a-serious-security-problem-in-your-p…
- wordpress.org /support/topic/am-i-still-being-attacked-htaccess-wp-content…
- wordpress.org /support/topic/please-remove-false-error-messages-from-admin…
Questions
- Can I secure WordPress without a security plugin?
- Yes. A small site can be secured manually with updates, HTTPS, strong unique accounts, two-step authentication, tested off-site backups, sensible permissions and regular reviews. The drawback is that scans, firewall maintenance, file monitoring and login protection become recurring jobs. A plugin is useful when you need those checks scheduled or do not want to maintain them yourself.
- What should I do first if my WordPress site may be hacked?
- Take the site out of normal operation if possible, contact your host, preserve logs and make a known-good backup or forensic copy before deleting files. Change WordPress, hosting, database and email passwords from a clean device, check administrator accounts, and scan both files and the database. Restoring an old backup without finding the original vulnerability can lead to reinfection.
- Should I disable XML-RPC to secure WordPress?
- Not automatically. XML-RPC is used by some integrations and disabling it can break connected services, while leaving it enabled can be unnecessary exposure if your site does not use it. First check whether Jetpack, mobile publishing or another integration depends on it. If you do not need it, block it with a carefully tested server or security rule rather than pasting an unverified snippet into production.
- Are file permissions of 777 safe for WordPress?
- No. Setting files or directories to 777 grants broad read, write and execute access and should not be the routine fix for a plugin or backup error. Correct permissions depend on the host, file ownership and the PHP user. Ask hosting support to correct ownership or the specific directory instead, and keep backup files outside public web access where possible.
- Does disabling the WordPress file editor stop hacking?
- No. <code>DISALLOW_FILE_EDIT</code> removes the dashboard editor for plugin and theme files, which limits one post-login attack path, but it does not prevent vulnerable plugins, stolen passwords, malicious uploads or server compromise. Use it alongside updates, least-privilege accounts, HTTPS, backups, firewall protection and monitoring.