Do you need to restore WordPress from a backup file? Backups help you restore your website in case something goes wrong. However, restoring WordPress from a backup file is not easy for beginners. In this article, we will show you how to easily restore WordPress from backup step by step.
Since this is a lengthy article, we have added table of contents for easier navigation.
- Understanding backups and restoring WordPress
- Restoring WordPress using BackupBuddy backup file
- Restoring WordPress using UpdraftPlus Backup
- Restoring WordPress database backup using phpMyAdmin
- Restoring WordPress database backup using cPanel
- Manually restoring WordPress files using FTP
- Troubleshooting backup restore issues
- Things to do after restoring your WordPress site
Note: This guide is about restoring a WordPress site from backup. If you are trying to move your website to a new domain, then you should check out our guide on moving WordPress to a new domain without losing SEO.
If you are trying to move from localhost to a live web hosting account, then follow this guide on how to move WordPress from local server to live site.
Understanding Backups and Restoring WordPress
There are different ways to create backups for your WordPress site. The best way to create a backup is by using a WordPress backup plugin.
Restoring WordPress from backups depends entirely on how you created the backup. For example, backups created using BackupBuddy or UpdraftPlus can be restored by using the same plugin. Similarly, manual backups need to be manually restored.
A lot of WordPress users don’t backup their entire websites. Instead, they only backup their theme, uploads directory, and their WordPress database. This reduces their backup size, but increases the steps needed to restore the site.
No matter how you created your backup, the basic steps are the same.
Let’s take a look at how to restore your WordPress site from backup. Since we’re covering different restore methods, please skip to the section that applies to you.
Restoring WordPress from BackupBuddy Backup File
You will need to download a copy of
importbuddy.php file. In the process, you will be asked to provide a password for importbuddy. This password will be used when you restore your website.
Next, you need to download a copy of your backup if you haven’t already done so. You can download it from BackupBuddy » Backups or the destination that you used to store your backups.
Once you have the backup zip file and importbuddy.php stored on your computer, connect to your website using FTP.
If you have a complete backup of your website, then delete all files and folders from your server.
However, if you have a partial backup, then you need to first download the files that you haven’t backed up. Once you are sure that you have everything backed up, proceed deleting all files and folders from your website’s root directory.
Next you need to upload your BackupBuddy backup and importbuddy.php files to your website’s root folder.
Once both files are uploaded to the server, visit importbuddy.php in your web browser. It is in your website’s root directory, so its URL will be something like:
ImportBuddy will now ask for the password that you created when you downloaded ImportBuddy.
On the next screen, ImportBuddy will display the backup file you uploaded. In case you did not upload your backup file using FTP, then you can click on the upload tab to upload the backup file now. If you have your backups stored on iTheme’s Stash storage service, then you can connect to it by clicking on stash tab now. Once you have selected your database, click on Next Step to continue.
ImportBuddy will unzip your backup file and show you a success message when it has extracted the files. Click on the next step button to continue.
On the next screen, ImportBuddy will ask you to provide site URL and database information.
If you are restoring a hacked WordPress website or trying to remove malware, then you do not want to use your old database.
You can either drop tables from your old database using phpMyAdmin, or create a new database using cPanel. Once you are done creating a new database or emptying the old one, provide your database details.
On the other hand, if you are sure your site wasn’t hacked, then you can use the same old database details.
Click on the next button to continue and importbuddy will now test your database settings and import your data. Once it is done, click next step to continue.
Now ImportBuddy will update your site URLs, paths, etc. After that, you will be asked to test your site. If everything is working fine, then you have successfully restored your website.
On the importbuddy page, click ‘Clean up and remove temporary files’ button. This will delete temporary data in database and files created during restoration.
Restoring WordPress using UpdraftPlus Backup
First you need to make sure that you have a complete backup of your WordPress site created by UpdraftPlus. Next, you need to download the backup files to your computer.
If your backups are stored by UpdraftPlus on a remote storage location like Dropbox, Google Drive, etc, then you can download your backup files from those locations to your computer.
Next, you need to connect to an FTP client and delete all WordPress files. After that you need to install WordPress again and login to your website.
You will need to install and activate the UpdraftPlus plugin. Upon activation, visit Settings » UpdraftPlus Backups page and click on the Restore button.
Next, you need to click on the ‘Upload backup files’ link and then uplaod the backup files you downloaded earlier.
Once your backup files are uploaded, UpdraftPlus will scan those files and will show them on the backups page.
You will need to click on the ‘Restore’ button to proceed.
This will bring up a popup where you need to click on the restore button again to continue. Make sure that all available backup files such as plugins, database, themes and others are selected.
UpdraftPlus will now start extracting and restoring data from those files. Upon success, you will be redirected to the success page.
That’s all, you have successfully restored your WordPress site from an UpdraftPlus backup.
Restoring WordPress Database from Backup using phpMyAdmin
When restoring a manually created backup, you may come across two possible choices. You can either create a new database and import your backup into it, or you can empty your existing database and import backup.
If you are cleaning a hacked WordPress website, then it is very important to change your MySQL username and password before creating a new database or importing into existing database.
To create a new database, login to the cPanel dashboard of your WordPress hosting account and click on the MySQL Databases icon.
Next, you will be asked to provide a name for your database and then click on the ‘Create Database’ button.
After creating the new database, you need a MySQL user associated with that new database. Scroll down to the MySQL users section and add a new user.
Next, you need to add this user to the MySQL database. Scroll down to ‘Add user to database’ section and select the user along with the database from the drop down menus and then click on the add button.
Now your new database is ready. You can use it to restore your WordPress database backup.
Head over to the cPanel dashboard again and then click on the phpMyAdmin icon.
Next, you need to click on your new database name and then click on the import button.
Click on ‘choose file’ button to select your WordPress database backup file and then click on the go button at the bottom of the page to continue.
PhpMyAdmin will now upload your backup and import it into your database.
You will see a success message upon completion.
That’s all. You have successfully imported your WordPress database. Now the next step is to install WordPress using your new database. If you have already installed WordPress, then add your new database settings into your wp-config.php file, and you will be good to go.
Restoring WordPress Database Backup using cPanel
If you manually created a WordPress database backup using the cPanel on your shared hosting, then you can also restore that database using cPanel.
Log into your cPanel account and under the files section click on Backup.
On the backups page, scroll down to ‘Restore a MySQL database backup’.
Next, click on the choose file button and select the backup file from your hard disk. Once done, click on the upload button.
Manually Restoring WordPress Files using FTP
If you are restoring WordPress to clean up a hacked site, then you first need to delete all existing WordPress files and directories.
Only do this if your backup is upto date, and you have everything customized, changed, or uploaded on your website.
If you have all your uploads and customizations, then you can safely delete everything on your website using cpanel (way faster) or using FTP.
To delete all files from your website, login to the cPanel of your hosting / VPS hosting and under files section click on the file manager icon.
Go ahead and choose Web root as your directory and proceed. File manager interface will now open in a new browser tab. You will need to select all WordPress files and delete them. This way is much faster.
You can also delete files using FTP, but it’s slower. Simply connect to your website using an FTP client and select all files in your WordPress root directory to delete them.
Next, you need to download a fresh copy of WordPress from WordPress.org and extract it to your hard disk.
Launch your FTP client and then upload all WordPress files to your server.
Once you have uploaded WordPress files, you can upload wp-config.php file from your backup (only if you are sure that it is clean and not compromised).
Alternately, you can rename wp-config-sample.php file in your freshly uploaded WordPress files to wp-config.php file. After that you will need to edit wp-config.php file and enter your database information.
Don’t forget to save the file and upload it back to your website.
Next, you need to upload other files from your backup. We will recommend that you only upload your images in /wp-content/uploads/ directory.
Once you have uploaded these, visit your website to check that everything is working fine.
Next, you need to login to your WordPress admin area and start installing plugins you had on your site.
Now you can move on to install your theme. If you had customized your WordPress theme or were using a child theme, then you can restore it from backup. However, make sure that those files are clean.
Lastly, go to Settings » Permalinks and adjust permalinks settings to match your site and then update permalinks.
Troubleshooting WordPress Backup Restore Issues
There are some common problems that you may come across when restoring your WordPress website. We have separate guides for each of them.
- Error establishing a database connection
- White Screen of Death
- Internal Server Error
- Login Page Redirect or Refresh issue
- Single Posts returning 404 Error
Things to do After Restoring your WordPress Site
Once you have successfully restored your website, we strongly recommend that you improve your website security.
If you haven’t done so already, please make sure that you have a regular WordPress backup with one of these WordPress backup plugins.
For securing your website, we will recommend that you immediately change your WordPress password. If you are running a multi-user website, then ask all users to update their passwords immediately.
You can also install a website firewall. At WPBeginner, we use Sucuri to monitor and strengthen security of our website. It monitors for security threats, and they also offer malware removal service with their subscription plans. See how Sucuri helped us block 450,000 attacks in 3 months.
We hope this article helped you learn how to restore WordPress from backup. You may also want to see our ultimate step by step WordPress security guide for beginners.