How to secure a WordPress site

A practical WordPress security checklist for shared hosting: updates, logins, users, file permissions, wp-config.php and backups.

Guide2 min readLast updated
On this page
  1. 1. Keep everything updated
  2. 2. Delete what you don’t use
  3. 3. Lock down logins
  4. 4. Review users
  5. 5. Protect wp-config.php and disable file editing
  6. 6. Sensible file permissions
  7. 7. Block PHP in uploads
  8. 8. HTTPS everywhere
  9. 9. Backups you can restore
  10. If it’s already compromised
  11. Common questions

You don’t need a heavyweight security suite. These measures prevent the vast majority of WordPress compromises.

1. Keep everything updated

Core, plugins and themes. Enable auto-updates for trusted plugins. Updating WordPress, themes and plugins safely

2. Delete what you don’t use

Unused plugins and themes, even deactivated, can be exploited. Delete them.

3. Lock down logins

4. Review users

Users → All Users: remove old accounts, and give each person the lowest role they need. Editors don’t need to be Administrators.

5. Protect wp-config.php and disable file editing

Add to wp-config.php:

define('DISALLOW_FILE_EDIT', true);

This removes the built-in theme and plugin editor, which attackers use to insert code once they’ve logged in.

6. Sensible file permissions

Folders 755, files 644, wp-config.php 640 or 600 if your site still works. Never 777. File permissions explained (644, 755 and why never 777)

7. Block PHP in uploads

Create wp-content/uploads/.htaccess containing:

<FilesMatch "\.php$">
 Require all denied
</FilesMatch>

Uploaded images never need to run as code.

8. HTTPS everywhere

How to force HTTPS (redirect HTTP to HTTPS)

9. Backups you can restore

Kept off the server. How to back up WordPress

If it’s already compromised

How to clean a hacked WordPress site

Prefer to follow along?

Everything in this guide works on Traxio’s WordPress hosting: £0.99 a month.

Common questions

How do I secure a WordPress site?

Keep core, themes and plugins updated, use a long unique admin password, remove anything you are not using, and keep backups you control. Outdated plugins are how the overwhelming majority of WordPress sites get compromised.

Spotted something out of date or unclear? Tell us and we’ll fix it.

Keep going