Website security

How to stop your WordPress website getting hacked

The PHP2Shell flaw put millions of websites at risk in October. Here's what happened, and the practical steps that keep a WordPress site from getting hacked.

By Published 5 min read

How to stop your WordPress website getting hacked

The short answer

Keep your server's PHP version patched, keep WordPress, plugins and themes updated, delete what you don't use, use strong passwords with two-factor authentication and keep off-site backups. Or move to a website that doesn't need constant patching at all.

In October, a serious security flaw called PHP2Shell put millions of websites at risk, including a huge number of WordPress sites. If you run one, now is a good time to learn how to stop your WordPress website getting hacked.

Most WordPress hacks are preventable. The steps below make your site much harder to target.

What happened with PHP2Shell

PHP is the programming language WordPress runs on, behind the scenes on your hosting server. On 21 October 2026, two fixes were released for critical flaws that let attackers run their own code on a server without logging in.

These flaws were rated 9.2 out of 10 for severity. These high ratings are rare as general software bugs are usually in the low to moderate rating.

And within a few hours it sent the Internet into a frenzy of emergency patching and voluntary blackouts.

The tricky part is that this isn't a WordPress problem.

Updating WordPress, your plugins or a security plugin doesn't fix it, and only your hosting company updating PHP on the server does.

SecurityWeek and Wiz have the technical details if you're curious.

Why WordPress sites get hacked

The WordPress core itself is well maintained.

Where most hacks come through is the bits that extend it.

Outdated plugins, abandoned themes, weak passwords and old server software could all cause issues.

We often find small business sites that have twenty to thirty plugins, each made by a different developer. If even only one of those are not maintained, it could cause the entire site to go down.

WordPress powers a large share of the web. This also makes it a big target. Attackers use automated tools that scan the web, looking for any door left open.

How to stop your WordPress website getting hacked

1. Check which PHP version you're on

This is the lesson PHP2Shell taught everyone. Login to your Cpanel hosting to check or contact your host and ask which PHP version your site runs on, and whether they've applied the October fixes.

The patched versions are 8.5.12, 8.4.27, 8.3.36 and 8.2.35, or anything newer. If you're still on PHP 7 or older, you're overdue for an upgrade regardless.

2. Keep WordPress, plugins and themes updated

Most updates include security fixes, so turn on automatic updates where you can. Check in at least once a month for anything that needs a manual update.

3. Delete plugins and themes you don't use

A deactivated plugin can still be a way in. If you're not using it, delete it, along with any old themes you've switched away from.

4. Only install well-supported plugins

Before adding a plugin, check when it was last updated and how many sites use it. A plugin that hasn't been touched in at least 6 months is a risk.

5. Use a security plugin

This is a non-negotiable. Install a WordPress security plugin as soon as possible, ideally during the initial setup phase.

6. Use strong passwords and two-factor authentication

All admin accounts on your website should have a long, unique password. Then turn on two-factor authentication, so a stolen password alone isn't enough to get into your site.

While you're there, remove any admin accounts for those who no longer need access to your site.

7. Keep off-site backups

Make sure your backups are stored somewhere other than your hosting account. Don’t assume that your hosting company is keeping backups.

If your site does get hacked, a clean backup is often the fastest way back.

Test a restore now and then, because a backup you can't restore isn't really a backup.

8. Choose good hosting

Cheap hosting often means old server software and slow security updates.

As the saying goes, you get what you pay for.

A good host patches problems like PHP2Shell quickly, often before you've even heard of them.

Our guide to website hosting in South Africa covers what to look for.

9. Watch for warning signs

Look out for strange things happening on your website,

New admin users, files you don't recognise, pages redirecting to spam or security warnings from Google are all signs to watch out for.

If you spot any of these, contact your hosting company or developer straight away. The sooner it's cleaned up, the less damage it does to your reputation and your Google rankings.

10. Consider moving off WordPress

Every step above is about keeping doors locked. The other option is to have far fewer doors to exploit in the first place.

While WordPress was the most common choice for building websites a few years ago, there are quite a number of other options available today.

A modern website doesn't have to depend on plugins and server software that need constant patching. When there's less running behind the scenes, there's far less for a flaw like PHP2Shell to attack.

That's how we build websites for our clients. They're fast, secure by design and don't need monthly plugin updates, and you can still update your own content easily.

Is WordPress still a good choice?

WordPress isn't bad, and it can be kept secure with regular care. The real question is whether you have the time, or the budget, to give it that care every month.

For a busy service business, a website that doesn't need constant security updates is often the simpler choice. You get on with your work, and your website gets on with bringing in enquiries.

If you're thinking about moving, we'll look at your current site and tell you honestly what's involved.

Thinking about moving off WordPress?

Book a free call and we'll look at your current site, what moving would involve and what it would cost.

Book a call

FAQ

Questions we get asked a lot

Can't find what you're looking for? Reach out and we'll get back to you.

Was my WordPress site affected by PHP2Shell?

If your host hadn't updated PHP to a patched version, your server was exposed. Ask your host which PHP version you're on and whether the October fixes were applied.

Will a security plugin protect me from PHP2Shell?

No. PHP2Shell is a flaw in the server software underneath WordPress, so only your host updating PHP fixes it. Security plugins still help with other threats.

How do I know if my WordPress site has been hacked?

Common signs include unknown admin users, strange files, spam pages or redirects, and security warnings from Google or your host. Contact your host or developer straight away if you see any of them.

Can you move my WordPress website to a new platform?

Yes. We rebuild the site, carry over your content and keep or redirect your page addresses, so you don't lose the Google rankings you've built up.

Ready to attract more clients?

Get a website that brings more visibility and enquiries.

We build strategic websites for service businesses that improve local visibility, build trust, and turn visitors into clients.