How do I back up a WordPress site?
Why Backups Matter
At HostingDuty, we treat backups as a non-negotiable part of site security. A backup is your only insurance against data loss from hacks, failed updates, or accidental deletions. Without a verified backup, a site outage can become a permanent loss.
The Two Components of a WordPress Backup
A complete WordPress backup consists of two distinct parts:
1. The Database: This contains all your posts, pages, comments, settings, and user data. It is stored in MySQL or MariaDB.
2. The Files: This includes the wp-content directory (themes, plugins, uploads), core WordPress files, and configuration files like wp-config.php.
As noted in the WordPress Advanced Administration Handbook, the recommended order is to back up the database first, then the files. This ensures that the file structure matches the database state at the time of the backup.
Methods to Create Backups
1. HostingDuty Control Panel (cPanel)
If you are on a shared hosting plan, the most reliable method is using the built-in backup tools in your control panel. Log in to cPanel, navigate to the Backup section, and select Full Backup or Download a WordPress Backup. This creates a compressed archive of your entire account.
For more granular control, you can download the database separately via phpMyAdmin or the MySQL Databases section. See our tutorial on /tutorials/cpanel-backup-guide for step-by-step instructions.
2. WordPress Plugins
Plugins are ideal for automated, scheduled backups. Popular options include UpdraftPlus, All-in-One WP Migration, and Duplicator. These plugins allow you to schedule daily or weekly backups and store them off-site (e.g., Google Drive, Dropbox, Amazon S3).
When using a plugin, ensure you configure the retention policy. We recommend keeping at least 7 days of daily backups and 3 months of monthly backups. This balances storage costs with recovery needs.
3. Manual FTP/SFTP Backup
For advanced users, you can manually download the wp-content folder via FTP/SFTP and export the database via phpMyAdmin. This method is error-prone and time-consuming but offers full control. Always verify file integrity after transfer.
Testing Your Backups
A backup is useless if it cannot be restored. At HostingDuty, we emphasize that testing is mandatory. Do not assume a backup file is valid just because it was created.
To test a backup: 1. Set up a staging environment (a subdomain or local server). 2. Restore the backup to this environment. 3. Verify that the site loads correctly and that content is intact.
For guidance on previewing backups safely, refer to our guide on /tutorials/preview-wordpress-backup. If you only have a database backup, see our resource on /kb/restore-site-from-database-only.
Best Practices for HostingDuty Users
- Automate: Schedule backups to run automatically. Human error is the leading cause of missed backups.
- Off-site Storage: Store backups on a different server or cloud service. A server crash will not destroy your backups if they are off-site.
- Version Control: Keep multiple versions of backups. If a recent backup is corrupted, you can roll back to an earlier one.
- Security: Encrypt sensitive backup files. Do not store them in a publicly accessible directory.
Common Pitfalls
- Incomplete Backups: Backing up only the database or only the files leads to a broken site upon restore. Always back up both.
- Unverified Backups: Never skip the restoration test. A corrupted backup file is indistinguishable from a valid one until you try to use it.
- Outdated Plugins: Outdated backup plugins may fail to connect to off-site storage or may be incompatible with newer WordPress versions.
Related Resources
- Learn how to restore a WordPress site with just a database backup: /kb/restore-site-from-database-only
- Compare backup plugins: /compare/updraftplus-vs-all-in-one-wp-migration
- Understand WordPress file structure: /glossary/wp-content-directory
People also ask
- How do I restore a WordPress site from a backup?
- What is the best WordPress backup plugin?
- How often should I backup my WordPress site?
- How do I test a WordPress backup?
- What files are included in a WordPress backup?