Before making any changes to your WordPress site, it’s important to create an up-to-date WordPress backup. That way, if things take a turn for the worse and you can’t even undo the changes you made, you can always restore WordPress from backup.
Having to conduct a WordPress restore from backup may sound intimidating - but it really isn't difficult to put everything back together.
Here's how to restore WordPress from backup:
- Step 1: Delete all existing WordPress files
- Step 2: Upload a new copy of WordPress
- Step 3: Upload WordPress backup files
- Step 4: Re-install plugins and themes
- Step 5: Update permalinks
Step 1: Delete All Existing WordPress Files
This is especially important if your site was hacked, as any existing files could be compromised.
However, you will want to be certain that you have a reliable WordPress restore backup before deleting anything.
Connect to your site's files through the ‘File Manager’ within your host’s cPanel or with an FTP client.
If WordPress was installed within your site’s root directory, typically named ‘/public_html/’, you should see several folders and files related to WordPress within that folder. When ready, delete all of these files.
Step 2: Upload a New Copy of WordPress
You will now need to upload a fresh copy of WordPress to your site. Navigate to wordpress.org to download the latest version of WordPress. Save the zipped folder to somewhere you can easily access on your computer, then unzip it using your computer’s file manager.
Using the cPanel File Manager or your FTP client, you then need to upload the unzipped WordPress files back to your site. If you are installing to the root folder of your site, this will be in the ‘/public_html/’ directory.
Step 3: Upload WordPress Backup Files
The first file you need to upload from your backup folder is the ‘wp-config.php’ file, which will connect your new WordPress installation to your MySQL database.
However, only upload the ‘wp-config.php’ file if you are confident that it has not been compromised by your site changes or a hacker.
Otherwise, you can edit the ‘wp-config-sample.php’ that came with your fresh WordPress download.
Download the file with your FTP client, open it in a text editor, and then enter the login information for the MySQL database on your host that you created when you originally installed WordPress.
A lot of this information can be received from your host's customer support.
When done, change the name of the file to ‘wp-config.php’ and re-upload it into the folder where you uploaded the WordPress installation files.
Once this is done, you can copy all of the files and folders from your WordPress backup to your site’s root directory. Replace any files that came with the WordPress download that have the same names as files in your backup. If you have images, it is good practice to upload these to the ‘/wp-content/uploads’ directory.
Step 4: Re-install Plugins and Themes
Unfortunately, even if your backup contains the files from your plugins and themes, they will not automatically be installed in the new instance of WordPress.
You can install plugins by navigating to ‘Plugins > Add New’ and searching for the plugins you had previously installed. If you had plugins that came from outside of the WordPress plugin marketplace, you will need to use the ‘Upload Plugin’ interface to upload the source files for those plugins.
Similarly, if the theme your WordPress site was using came from the WordPress theme marketplace, you can navigate to ‘Appearance > Themes > Add New’ to search for that theme and re-install it. If you had a custom theme or had added custom code to your theme, you can restore the theme from backup by clicking ‘Upload Theme’.
Step 5: Update Permalinks
At this point, your WordPress restore should be nearly complete and everything should be working normally on your site with the possible exception of blog posts.
This is because the new WordPress installation has a default permalink style for blog posts, which may differ from the permalink style you were using prior to the WordPress backup and restore.
To correct this, navigate to ‘Settings > Permalinks’ and choose the style of permalink that matches the style of your existing blog posts’ URLs.
Alternative Methods Of Backup
The method described above is suitable for a complete, manual restore and does not rely on any third-party plugins. However, you can restore WordPress from backup more easily if you used a paid backup plugin such as Backup Buddy, Backup & Staging, or a number of others that are available via the WordPress Plugins Directory.
These plugins are designed to create a WordPress restore backup in just a few clicks. They then to restore your content upon a new updated WordPress installation.
Typically, the process for conducting a WordPress backup and restore with these plugins first involves installing and activating the plugin.
To use Backup Buddy as an example, you then navigate to ‘Backup Buddy > Restore/Migrate’ and click ‘Download Importbuddy.php’. This file can then be placed in your root folder with your backup and fresh WordPress installation, and visiting ‘www.yoursite.com/importbuddy.php’ will open a wizard that walks you through the restore process.
How to Restore a WordPress Site Without Backup
Unfortunately, there is no way to truly restore a WordPress site without a backup. That doesn’t mean you’re completely out of luck in the event that your site is hacked or suffers a failure. But, you should expect to invest a lot more manual work in getting your site back to where it was and recovering your posts and content.
The main reason that restoring a WordPress site without a backup is possible at all is that search engines and Internet archives are constantly creating cached versions of your site.
In particular, Google’s cache service displays functional links and pages just as your website did at the time of the cache. Bing and the Internet Archive’s Wayback Machine also offer cached versions of your site.
To find the cached version of your website on Google, navigate to ‘http://webcache.googleusercontent.com/search?q=cache:http://yoursite.com’.
You can then copy the source code of each page on your site and upload them as html documents to your host to restore them. Looking through the cached source code will also allow you to restore any custom code you added to your theme.
Importantly, once you are able to restore part or all of your website from cached pages, you need to set up backups so that your content is not lost again going forward. You may also need to take extra steps to protect your website if hacking was the cause of your restore.
Restore WordPress from Backup: Final Thoughts
While having to restore WordPress from backups is something that no one likes to think about, it is essential to keep your site backed up in case this becomes a necessity after a hack or crash.
Creating a WordPress restore backup is simple and fast - it offers you the ability to get your site back up and running with little or no lost content whatsoever. In more desperate situations, you can turn to cached versions of your site to restore a WordPress site without a backup.
Did this tutorial help you with WordPress backup and restore or teach you how to restore a WordPress site without backup? Let me know in the comments below!