The WordPress site consists of two parts, and the backup must include both:
- from the files: the WordPress core, the themes, the plugins and the uploaded images and documents in the
wp-content/uploadsfolder, as well as thewp-config.phpfile; - From the database: posts, pages, settings, users and, in the case of the online shop, orders.
Daily backups on the hosting account
We perform daily backups on our cPanel and WordPress hosting plans; for cPanel hosting, we store these backups in a geographically separate location. Within cPanel, you can restore a previous daily state yourself via the JetBackup interface, even if it’s just a single file or database; the steps are outlined in the article on restoring files and databases from backups. This is the simplest solution if something has gone wrong and you know on which day the site was still working.
Backup with WP Toolkit
Before carrying out an update or a major change, you can perform a backup of your site with a single click in WP Toolkit:
- In cPanel, open the WP Toolkit menu item.
- On the WordPress installation page, click on ‘Backup / Restore’.
- Click the ‘Backup’ button. The backup includes both files and the database.
You can also restore or download your backup here. If you wish to test a change before going live, the staging environment offers even greater security; see: Creating a WordPress staging site with WP Toolkit.
Backup with a plugin
Plugins such as UpdraftPlus and Duplicator perform scheduled backups and can also upload the backup to external hosting (such as Google Drive, Dropbox or S3-compatible hosting). This ensures you have a copy independent of your hosting provider. Do not store backups in the public_html folder, as anyone can download them from there if they can guess their names.
Manual backup
- Files: In cPanel’s File Manager, compress the WordPress folder and download the ZIP file; or download it via FTP.
- Database: in phpMyAdmin, select the database and, on the Export tab, save it as an SQL file.
If you have SSH access, you can also perform a backup quickly via the command line. On our cPanel servers, the wp db export command does not work (the PHP function proc_open is disabled), so please perform the backup using the mysqldump command; the steps are described in the article on using WP-CLI. The comparison of backup plugins explains what each backup plugin is used for and why the backup location matters.
There is a separate article on the backup of your entire cPanel account.
Restore
- Always restore both the files and the database to the same point in time; if you restore only one of them, the site may not function correctly (for example, due to missing images or plugins).
- Restoring your data will overwrite any data created since then (new entries, comments, orders), so if you have an online shop, please perform a backup beforehand.
- If you are restoring the backup to a different domain, you must also replace the old URLs in the database, for example:
wp search-replace 'https://regi.hu' 'https://uj.hu'. This is also necessary during migration; see the article on WordPress site migration to aWh.
Why not give it a go?
The backup is only useful if you can actually restore from it. Restore it to a test environment from time to time and check that everything is there.