How to restore a WordPress site
There are all manner of reasons why you might need to rollback or restore a WordPress site - maybe an update didn't work as expected or your site was hacked and is now infected with malware.
We offer some pre-cautions and best-practise advice first, followed by details on how to restore your full WordPress site including files and database.
Always test updates
Never update your live site without testing - we have a guide on creating a staging site using Softaculous.
Backup, backup, backup - use a third party plugin to ensure you have regular off-site and off-hosting backups. Whilst we take regular backups, we always suggest that you setup your own off-site/off-server backup regime. There are a number of plugins and hosted solutions you could use, including UpdraftPlus or All-in-One WP Migration. Make sure you take backups of both your live and dev/staging sites before you make any changes - so you'll be able to restore them easily should there be any issue.
We also offer Backups Pro - and enhanced backup options that gives more restore points - check this guide to see if it's available on your plan.
Dynamic Sites e.g. e-commerce shops
Be very aware that if you restore a dynamic site - that collects, stores or processes user data - for example a WooCommerce shop - you will lose any details (clients, orders etc.) obtained between the time of the original backup and the time when you restore.
If you know what you're doing, for example it's a test or development site then feel free to carry on. However, if you're trying to recover from malware or a hack and you don't want to lose data you may want to consider asking a third party developer, or malware cleanup specialist to take a look.
Restoring a WordPress site from Krystal backups
WordPress sites consist primarily of two parts that work together - a database and some files.
In order for a WordPress site to function, you need both these elements and they need to be connected.
Depending on what you're trying to achieve you may just want to restore either your files or database. We explain how to do both and make sure they are joined up.
Both the database and file restore will be completed using JetBackup from within your cPanel. We have separate guides on restoring files with JetBackup and restoring databases using JetBackup. Whilst we detail any specifics you'll need to know or note before restoring - you will follow the process in these JetBackup guides to do the restorations.
- Prior to restoring the WordPress database, you'll need to confirm the database name for the site you'd like to restore. This can be found in the
wp-config.phpfile in your sites document root (top level directory). These configuration details in
wp-config.phpare what link the database to the related files.View or Edit the file and make a note of the database name (DB_NAME).
/** The name of the database for WordPress */
define( 'DB_NAME', 'sharedkr_wp556' );
- Now you know the database name you can follow the process detailed our JetBackup guide restore the correct database. There is no need to delete the existing database as it'll be overwritten during the restore.
- If you are restoring because your site has been hacked it's important to change the database username and password. We have a separate guide on steps to cleaning malware. Once you've changed the database users details you should update
wp-config.phpwith the new username and password.
- You can follow this JetBackup guide to restore your WordPress files - either an individual file, a custom selection of files or all of them.
Files will be over-written - but any files not in the backup will remain. So, again if you're restoring due to malware or your site being hacked you would probably be better off taking a full file backup (using cPanel backup or FTP to save the files locally) and then deleting all WordPress files before restoring.