WordPress
WordPress Backup Strategy: A 3-2-1 Setup That Survives a Hack
A WordPress backup is only as safe as the keys that can delete it. Most small business sites run a backup plugin that sends copies to cloud storage, which sounds fine until you notice where the cloud storage password lives: inside the WordPress site. Whoever gets into the site can usually reach the backups too.
That's the gap this post closes. The classic 3-2-1 rule still holds, but for a website it needs two upgrades: at least one copy the site can't reach, and at least one copy nobody can delete for a set number of days. Offsite and immutable. Here's how I set that up, in plain English.
If you'd rather have this built and tested for you, tell me about your hosting in the maintenance questionnaire and I'll reply with a plan and a fixed quote within one business day.
What 3-2-1 means for a WordPress backup
The 3-2-1 rule is old advice from the data world: keep three copies of your data, on two different kinds of storage, with one of them offsite. CISA, the US government's cybersecurity agency, still tells organizations to follow the 3-2-1 backup rule and to protect backups with encryption and offline copies.
Translated to a WordPress site:
- Copy 1 is the live site itself.
- Copy 2 is a backup on a different system, usually your host's own backup service.
- Copy 3 is offsite, in storage that doesn't depend on your host or your WordPress login.
What needs backing up: the database (all your posts, pages, orders and settings), the wp-content folder (uploads, themes and plugins), wp-config.php and .htaccess. WordPress core files can be downloaded fresh, so they're optional.
Why most WordPress backups don't survive a hack
Here's the uncomfortable part. A typical setup has three weak spots, and an attacker who gets in can hit all of them.
The backup lives in the same hosting account. Plugins often store backup files in a folder inside wp-content. If the account is compromised, those files can be deleted, or worse, quietly infected so your "clean" restore brings the malware back.
The cloud credentials live in the WordPress database. A plugin that uploads to Dropbox, Google Drive or Amazon S3 has to store a key to do it. That key typically sits in the site's database. An attacker with admin access or database access can find it and use it to delete everything in the remote storage.
Old backups expire before anyone notices the hack. If you keep seven days of backups and the infection started three weeks ago, every copy you have contains it.
This isn't paranoia. CISA's ransomware guide warns that many ransomware variants try to find and delete or encrypt accessible backups. Website attackers aren't always that thorough, but you shouldn't build your plan around their laziness.
The WordPress backup strategy I use: three layers
Each layer covers a failure the others miss.
| Failure | Host backups | Plugin to locked offsite storage | Pull backup from a separate server |
|---|---|---|---|
| Bad plugin update | Yes | Yes | Yes |
| Server or disk failure | Usually | Yes | Yes |
| Hacked WordPress admin | Usually | Yes, if the storage is locked | Yes |
| Hacked hosting account | Maybe not | Yes, if the storage is locked | Yes |
| Host suspends or loses the account | No | Yes | Yes |
Layer 1: your host's backups
Most decent hosts take nightly backups, and on cPanel or Plesk you can usually restore a single file or database from the panel. Keep using them. They're the fastest way back from a bad update.
But treat them as convenient, not safe. They live with the same company, often in the same data center, and a suspended account can take them along with it.
Layer 2: a backup plugin pushing to locked storage
A plugin such as UpdraftPlus can send backups on a schedule to remote storage, and its free version supports Amazon S3 and S3-compatible services. That's the part that matters, because S3-style storage offers two protections a Dropbox folder doesn't.
Protection one: a key that can upload but not delete. In Amazon S3 (or similar), create a separate access key just for the website, and give it permission to add files and nothing else. Even if an attacker steals it, the key can't remove anything.
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": ["s3:PutObject", "s3:ListBucket"],
"Resource": ["arn:aws:s3:::yoursite-backups", "arn:aws:s3:::yoursite-backups/*"]
}]
}That policy is the whole permission set for the website's key. What it can break: the plugin's "keep only the last N backups" cleanup will fail, because it isn't allowed to delete. Let the storage handle cleanup instead, with a lifecycle rule that removes old files after your retention period.
Protection two: object lock. Object lock makes each backup file impossible to change or delete until a date you choose. Amazon calls it a write-once-read-many model. In compliance mode, nobody can delete a locked file early, including the account's root user. Governance mode is softer: users with a special permission can still override it.
Backblaze B2 offers the same feature with the same two modes. Its docs describe compliance-mode locks as ones that cannot be removed by any user, only extended. For a small business, either service costs very little at the size of a typical site.
Test one upload before you rely on it. Locked buckets can be fussier about how files arrive, and not every plugin handles that well.
My rule of thumb: compliance mode, with a lock of at least 30 days. Hacks are often discovered weeks after they start, so you want a copy that's older than the infection.
Layer 3: a pull backup the website can't see
This is the strongest layer, and the one most guides skip. Instead of the website pushing backups out (which means it holds credentials), a separate machine pulls them in. The website holds no key to the backups at all.
# Runs on a separate backup server, never on the website itself.
# Pulls a compressed database copy and the site files over SSH.
# Could break: nothing on the site, but it uses some CPU on the host during the run.
DATE=$(date +%F)
ssh backup@yoursite-host 'cd ~/public_html && wp db export - | gzip' > /backups/yoursite/db-$DATE.sql.gz
rsync -a backup@yoursite-host:public_html/ /backups/yoursite/files-$DATE/The wp db export - part uses WP-CLI's option to write the export to standard output, so the database copy never sits on the web server at all. The backup server can be a small cloud server, or a computer in your office, as long as the website has no way to log into it.
For a larger site, swap the dated folder for a deduplicating backup tool, so each night only stores what changed.
How long to keep WordPress backups
Here's the retention schedule I default to. Adjust it to how often your site changes.
| Copy type | Keep | Why |
|---|---|---|
| Daily | 14 days | Covers bad updates and recent mistakes |
| Weekly | 8 weeks | Covers hacks found a few weeks late |
| Monthly | 6 to 12 months | Covers slow, quiet infections and accidental deletions nobody noticed |
A busy online store may want more frequent database backups, since orders change every hour. A five-page brochure site that changes twice a year can get away with less.
Restoring after a hack: the catch
A backup brings back your site, and possibly the hole the attacker used. Before restoring after a hack:
- Pick a date before the infection, not just "the latest one." The access log or the date of the first odd file helps.
- Restore to staging first and scan it, if you can.
- Update everything and change every password the moment it's live, including database, hosting and SFTP passwords.
Skip step 3 and you may be restoring the same problem with an older date on it. That's one of the most common reasons WordPress malware keeps coming back. If you're not sure the backup is clean, my hacked site cleanup covers the backdoor hunt that a restore skips.
Test the restore, or it doesn't count
CISA's ransomware guide is blunt about this too: test backup procedures on a regular basis. Every quarter, restore a recent backup to a staging site and check that pages load, you can log in, and recent posts or orders are there.
It's the step that turns "I think we have backups" into "I know we do." My quarterly maintenance routine puts it on the calendar with the rest of the routine.
Final Notes
A good WordPress backup strategy assumes the site will one day be in the wrong hands. Keep your host's backups for convenience, push a second copy to storage with a no-delete key and object lock, and if the site matters a lot, pull a third copy from a machine the website can't see. Then test a restore every quarter. That's 3-2-1, updated for the way websites actually get attacked.
WordPress backup FAQs
How often should I back up my WordPress site?
Daily is the sensible default for most small business sites. Online stores and booking sites that take orders all day may want database backups every few hours, since that's where orders live. A brochure site that rarely changes can get by with weekly backups, plus a manual backup before every update. Whatever the schedule, keep weeks of history, not just the last few days.
Are my host's backups enough?
They're a good first layer but not a full plan. Host backups usually live with the same company and sometimes in the same data center, and if the account is suspended or compromised, you may lose access to them. Keep using them for quick restores after bad updates, and add at least one offsite copy that your host and your WordPress login can't touch.
What is an immutable backup?
An immutable backup is a copy that can't be changed or deleted until a date you set, even by someone holding the storage password. Services like Amazon S3 and Backblaze B2 offer this through a feature called object lock. For websites, it means an attacker who steals your backup credentials still can't erase your history, so you always have a clean copy to go back to.
Can a hacker delete my WordPress backups?
Often, yes. If backup files sit in the same hosting account, an attacker with access can delete or infect them. If a plugin sends backups to cloud storage, the storage key is usually stored in the WordPress database, and an attacker can use it to wipe the remote copies. A key that can only upload, object lock, and a pull backup from a separate server close those gaps.
Is a backup plugin like UpdraftPlus enough?
A backup plugin is a solid second layer, especially paired with S3-compatible storage, an upload-only key and object lock. On its own, though, it runs inside the site it's protecting, so a serious compromise can affect it. Combine it with your host's backups and, for important sites, an independent pull backup. Then test a restore so you know the files actually work.
Next step
Backups that run, stay locked and get tested every quarter come standard with my monthly site maintenance. Send me a few details through the maintenance questionnaire and I'll tell you what your current setup would survive.
Want a second pair of eyes on your site?
Tell me what's going on in the wordpress maintenance questionnaire. I reply with a plan and a fixed quote within one business day.