A WordPress backup strategy is not complete until you've tested a full restore. Too many site owners discover their backup was incomplete or corrupted only after a disaster has already happened. This guide compares three common backup approaches, walks through automation for off-site storage, and shows you how to verify that your backups actually work.
Why WordPress Backups Fail
WordPress consists of two critical components: the filesystem (themes, plugins, uploads, core files) and the database (posts, pages, settings, users). A complete backup must capture both. Many backup failures stem from:
- Partial backups: Plugin backs up the database but not uploads, or vice versa
- Timeout issues: Large sites exceed PHP or web server timeout limits
- Permission problems: Backup process cannot read certain directories
- No off-site copy: Backup stored on the same server that fails
- Never tested: Backup file exists but cannot be restored
A reliable backup strategy addresses each of these failure modes.
Method 1: WordPress Backup Plugins
Backup plugins are the most accessible option for users without server access. Popular plugins handle both database and file backups through the WordPress admin interface.
Advantages
- No command-line access required
- User-friendly scheduling interface
- Built-in integration with cloud storage providers
- Automatic database optimization before backup
- Selective backup (exclude cache directories, for example)
Limitations
- Subject to PHP memory and execution time limits
- May struggle with sites over several gigabytes
- Adds overhead to the WordPress installation
- Depends on WordPress being functional
- Plugin vulnerabilities can expose backup files
Configuration Best Practices
When using a backup plugin:
- Schedule backups during low-traffic hours to reduce server load
- Exclude unnecessary directories like cache, temp files, and error logs
- Enable off-site storage to a service like Amazon S3, Google Drive, or Dropbox
- Keep local copies to a minimum (one or two recent backups) to save disk space
- Set email notifications for failed backups
- Use incremental backups for the filesystem if available, full backups for the database
Most backup plugins store archives in the wp-content/backups/ or similar directory. Ensure this location is excluded from public web access using an .htaccess deny rule or by storing backups outside the web root.
Method 2: cPanel Backup Tools
If your hosting account includes cPanel, you have access to built-in backup tools that operate independently of WordPress.
Full Account Backup
Navigate to cPanel → Files → Backup and generate a full account backup. This creates a compressed archive containing:
- All files in your home directory
- All MySQL/MariaDB databases
- Email accounts and forwarders
- DNS zone files
cPanel can deliver the backup to a remote FTP server or allow you to download it directly. For large accounts, cPanel splits the backup into multiple parts.
Partial Backups
For faster WordPress-specific backups:
- Database backup: Use cPanel → Databases → phpMyAdmin or the backup interface to export the WordPress database as a
.sql.gzfile - Home directory backup: Download a compressed archive of the
public_htmldirectory (or the specific subdirectory containing WordPress)
Advantages of cPanel Backups
- Independent of WordPress; works even if the site is broken
- No PHP timeouts or memory limits
- Includes everything needed to restore the entire hosting account
- Can be scheduled through cPanel's backup interface if your host enables it
Limitations
- Requires cPanel access
- Full backups can be very large and slow to generate
- Not all hosting plans include automated scheduled backups
- Some hosts charge extra for backup storage or restores
Automating cPanel Backups
If your host does not provide scheduled backups, you can automate partial backups with a cron job. Create a shell script that uses mysqldump and tar:
#!/bin/bash
# Save as ~/backup-wordpress.sh
DATE=$(date +%Y%m%d-%H%M%S)
BACKUP_DIR=~/backups
WP_DIR=~/public_html
DB_NAME="your_database_name"
DB_USER="your_database_user"
DB_PASS="your_database_password"
mkdir -p $BACKUP_DIR
# Backup database
mysqldump -u$DB_USER -p$DB_PASS $DB_NAME | gzip > $BACKUP_DIR/db-$DATE.sql.gz
# Backup files
tar -czf $BACKUP_DIR/files-$DATE.tar.gz -C $WP_DIR .
# Remove backups older than 7 days
find $BACKUP_DIR -type f -mtime +7 -delete
echo "Backup completed: $DATE"
Make the script executable and schedule it:
chmod +x ~/backup-wordpress.sh
crontab -e
Add a cron entry to run daily at 2 AM:
0 2 * * * /home/username/backup-wordpress.sh >> /home/username/backup.log 2>&1
Replace username with your actual cPanel username.
Method 3: rsync for Incremental Off-Site Backups
For VPS or dedicated server environments, rsync provides efficient incremental backups. It transfers only changed files, making it ideal for large WordPress installations.
Basic rsync Backup
To copy your WordPress installation to a remote backup server:
rsync -avz --delete /var/www/html/wordpress/ user@backup-server:/backups/wordpress/
Flags explained:
-a: Archive mode (preserves permissions, timestamps, symlinks)-v: Verbose output-z: Compress during transfer--delete: Remove files on destination that no longer exist on source
Database Backup with rsync
Combine mysqldump with rsync:
#!/bin/bash
# Save as /usr/local/bin/backup-wp-rsync.sh
WP_DIR="/var/www/html/wordpress"
DB_NAME="wordpress_db"
DB_USER="wp_user"
DB_PASS="secure_password"
BACKUP_SERVER="[email protected]"
REMOTE_PATH="/backups/wordpress"
TMP_SQL="/tmp/wordpress-backup.sql"
# Dump database
mysqldump -u$DB_USER -p$DB_PASS $DB_NAME > $TMP_SQL
# Sync files and database dump
rsync -avz --delete $WP_DIR/ $BACKUP_SERVER:$REMOTE_PATH/files/
rsync -avz $TMP_SQL $BACKUP_SERVER:$REMOTE_PATH/database/
# Clean up
rm $TMP_SQL
Advantages of rsync
- Extremely efficient for large sites; only transfers changes
- No dependency on WordPress or cPanel
- Full control over what is backed up and where
- Can run over SSH for secure transfers
- Works well with rotating backup schemes (daily, weekly, monthly)
Limitations
- Requires SSH access to both source and destination servers
- Steeper learning curve than plugins or cPanel
- Must configure SSH keys for passwordless authentication
- Does not include built-in cloud storage integration
Setting Up SSH Keys for Automated rsync
Generate an SSH key pair on the source server:
ssh-keygen -t ed25519 -C "wordpress-backup"
Press Enter to accept the default location. Do not set a passphrase (required for automated backups).
Copy the public key to the backup server:
ssh-copy-id -i ~/.ssh/id_ed25519.pub [email protected]
Test the connection:
ssh [email protected]
If you can log in without a password prompt, rsync will work in automated scripts.
Automating Off-Site Storage
Regardless of your backup method, storing copies off-site protects against server failures, data center outages, and ransomware.
Cloud Storage Options
Amazon S3: Use the AWS CLI to sync backups:
aws s3 sync ~/backups/ s3://your-bucket-name/wordpress-backups/ --storage-class STANDARD_IA
The STANDARD_IA storage class reduces costs for infrequently accessed backups.
Backblaze B2: Similar to S3 but often more affordable. Use the Backblaze CLI:
b2 sync --delete ~/backups/ b2://your-bucket-name/wordpress-backups/
Rsync.net or BorgBase: Specialized backup storage with native rsync support. No additional tools required.
Retention Policies
Implement a grandfather-father-son rotation:
- Daily backups: Keep the last 7 days
- Weekly backups: Keep the last 4 weeks
- Monthly backups: Keep the last 12 months
This can be managed with a script or by configuring lifecycle rules in S3.
Encryption for Off-Site Backups
Encrypt backup archives before uploading to third-party storage:
# Encrypt with GPG
tar -czf - /var/www/html/wordpress | gpg --symmetric --cipher-algo AES256 -o wordpress-backup.tar.gz.gpg
# Upload encrypted file
aws s3 cp wordpress-backup.tar.gz.gpg s3://your-bucket/
Store the encryption passphrase securely (password manager or offline storage).
Testing Your Backups
The only backup that matters is one you can restore. Test every backup method at least once, and retest after major WordPress updates or hosting migrations.
Plugin Restore Test
Most backup plugins include a one-click restore feature. Before testing in production:
- Create a staging subdomain (e.g.,
staging.yourdomain.com) - Install a fresh WordPress instance
- Install the backup plugin
- Upload and restore your backup archive
- Verify the site loads and all content is present
- Test login, media library, and critical functionality
cPanel Restore Test
For full account restores, contact your hosting provider. Most hosts can restore from their backup system to a staging account. For partial restores:
- Download the database
.sql.gzbackup - Create a new test database in cPanel
- Import the SQL file via phpMyAdmin
- Extract the file backup to a subdirectory
- Update
wp-config.phpwith the test database credentials - Access the test URL and verify functionality
rsync Restore Test
Reverse the rsync direction to restore files:
rsync -avz user@backup-server:/backups/wordpress/files/ /var/www/html/wordpress-test/
Restore the database:
mysql -u wp_user -p wordpress_test_db < /tmp/wordpress-backup.sql
Update wp-config.php and test.
Common Restore Issues
- Database prefix mismatch: Backup uses
wp_but new install useswptest_; updatewp-config.php - File permissions: Restored files owned by wrong user; run
chown -R www-data:www-data(or appropriate user) - Absolute paths in database: URLs and file paths reference old domain; use WP-CLI or a search-replace plugin
- Missing
.htaccess: Permalinks break; regenerate from Settings → Permalinks
Backup Checklist
Use this checklist to audit your WordPress backup strategy:
- [ ] Both database and files are backed up
- [ ] Backups run automatically on a schedule
- [ ] At least one copy is stored off-site
- [ ] Off-site backups are encrypted
- [ ] Backup failures trigger email alerts
- [ ] You have successfully restored a backup in the past 90 days
- [ ] Backup credentials are documented and accessible
- [ ] Backups are excluded from public web access
- [ ] You have tested restoring to a different server or hosting account
- [ ] Backup retention policy is defined and automated
Conclusion
A complete WordPress backup strategy combines multiple methods, off-site storage, and regular restore testing. Plugins offer convenience for shared hosting, cPanel backups provide an independent safety layer, and rsync delivers efficiency for large sites or VPS environments. The best approach uses at least two methods, stores copies in geographically separate locations, and includes a documented restore procedure that you have verified works. Regular testing is the only way to ensure that when disaster strikes, your backup will actually bring your site back online.
