WP Buffs Blog |

How to Restore WordPress from a Backup (End-to-End Guide)

Backup storage data internet technology business concept, Businessman hand holding backup icon on virtual screen.

Mongta Studio / stock.adobe.com

There are a number of reasons to capture and save backups of a WordPress website. A hacker defaces your website beyond repair. A user creates a mess of the code on the live server. A new plugin update conflicts with the theme and results in the white screen of death.

There are ways to protect your WordPress site from harmful situations like these. In case these hypothetical situations do ever become a reality, the WordPress backup is there, waiting for you to restore the site back to good standing.

good standing

Thankfully, there are WordPress backup and restore plugins you can use to capture these backups. What’s more, you can program them to automatically save backups — on your preferred schedule — and place them in the storage site of your choosing.

WP Buffs has previously detailed the process of saving a WordPress backup to Google Drive as well as how to commit a WordPress backup to S3. With most backup and restore plugins, you can choose from a wide variety of storage services, both free and paid.

But that’s not what we’re going to focus on today.

You know how to automate the process of saving WordPress backups. You also know how to store them in a remote and secure location. This helps with site speed, too. Now, we need to break down the process of restoring a WordPress website from a backup.

In this guide, we’re going to explore the various ways to restore a WordPress site:

Our team at WP Buffs helps website ownersagency partners, and freelancer partners backup and restore their WordPress sites. Whether you need us to manage 1 website or support 1000 client sites, we’ve got your back.

What You Need to Restore a WordPress Site from a Backup

When configuring the automation of your WordPress backups, you can choose to save certain parts of your website instead of the whole. For some web developers, this might make sense if storage is limited or if you know there are only some aspects of a website that change frequently.

That said, it’s still a risky choice to make.

By opting not to save everything in your:

  • Database – including all of your content, code, and data
  • Files – including your images, themes, and plugins

You may ultimately defeat the purpose of having a backup in the first place. If you don’t have a complete version of your WordPress site to revert to, you could end up having to do much more work to recover it in the end. So, before you do anything else, make sure your backups are correctly configured.

Files and database backup schedules

In addition to considering which parts of the site to save, also consider how frequently you should save the site too. For instance, if the content is updated or published daily, a daily backup schedule makes the most sense. For less frequently updated websites, you’ll want the backup schedule to equally mirror those changes.

The goal is to have a backup that doesn’t force you to redo work that occurred in the interim.

Now that we have that out of the way, let’s talk about what you actually need in order to perform the restore of a WordPress backup.

1. Remote and Secure Location to Store the Backup

Always remember to consider the size of your website when choosing a remote storage service.

Remote storage options

You don’t want to be in a position where a restore is in order, only to find that the backup failed to save because of storage limits being exceeded.

2. A Saved Backup of the Website

You can save this manually or automate it with a WordPress backup plugin.

S3 Saved Backups

3. Access to Your Control Panel.

From here, you can use either the file manager or FTP manager.

CPanel Options

4. Access to Your Database Tools

phpMyAdmin is the tool you need to manipulate your MySQL databases and tables.

Database Tools

You can access this through the control panel as well.

5. The Ability to Handle the Restoration

SitePoint suggests that there are three common ways to restore a WordPress website. That said, it really depends on which parts of your website need to be restored, how long your website is, as well as which tools you used to generate the backup in the first place.

A lot of that depends on your comfort level, to be honest. If you’re not confident in uploading files to FTP or replacing a corrupted database with one that’s untainted, a WordPress plugin or third-party service might be the better choice for you.

But let’s take a look at the options and see how much work is actually involved in each.

Restore a Backup from Your Managed Hosting Account

For those of you with clients whose websites reside on managed WordPress hosting, you can start here.

Managed WordPress hosts like Kinsta make this easy. As the Kinsta knowledgebase demonstrates, restoring a backup from Kinsta is as easy as clicking the Restore button and then waiting a few minutes for your website to return to safety.

Regular web hosting accounts may also include backup and restore services, as this example from BlueHost shows:

BlueHost Backups

As you can see here, though, there are a couple of issues:

  1. Backups are not automated, so it’s up to you to remember to save them.
  2. Backups that exceed the host’s limits won’t be captured in full nor will you be notified as such. Performing a restoration with incomplete files is a bad idea.

As such, even if your (managed) hosting company does offer backup services, it’s always a good idea to save your own copy in a remote location.

As Artbees explains:

Store your backup files in two secure locations (e.g. one in your computer and another on a cloud storage provider such as Google Drive, Dropbox, iCloud etc.) so that even if something bad happens to either one, you always have a spare to use.

When you don’t have a managed host to fall back on when it comes to WordPress website restorations, consider the following options.

Restore a WordPress Site Using a Backup Plugin

When managing WordPress backups on your own, the most logical choice to do so is with a backup and restore plugin. Not only will it automate the process and relieve you of the responsibility of remembering to capture backups, but it can also greatly simplify the restoration process.

[bctt tweet=”🔌 Take into account the size of the backup & how much server memory you have to work with. Restoring a #WordPress site using a backup plugin can sometimes cause errors. Know your limits!” username=”thewpbuffs”]

However, if you’re sure that your site is a reasonable size, let’s review how to use a backup to do this. (Even if you’re not, you can still use the plugin to execute the restore. Then, if it fails, you can proceed with the options below to bring your site fully back online.)

For the purposes of this tutorial, I’m going to use UpdraftPlus as it’s the backup plugin used in WP Buffs’ backup tutorials.

The process may differ with other plugins in terms of where you find the one-click Restore option or how many validation steps are included. But, in essence, the process should be quite similar.

Step 1a: Locate the Backup

The first thing to do is locate the most recent backup of your website. If you know that you need a full restore, make sure that both files and the database are saved in it.

Updraft Existing Backups

As you can see in this example, the following were captured on December 10:

  • Database
  • Plugins
  • Themes
  • Uploads
  • Others

This is exactly what we need.

Step 1b: Upload the Backup

If for some reason, you can’t find the backup you need in the plugin, you can retrieve it from your remote storage service.

Regardless of which storage service you use, your backup will be saved in a series of files. Download each of the ones you want (if not all of them). They will be clearly labeled by file type.

S3 Backup File

Under Existing Backups, UpdraftPlus enables you to upload the backup you want to use.

Updraft Upload Backups

You can add your zipped files here, or you can upload them to the /wp-content/ folder (using file manager or FTP) where the UpdraftPlus plugin is located.

Step 2: Restore the Backup

With the correct and full backup now inside your WordPress plugin, you can click the Restore button and initiate the process.

Restore the Backup

Select which of the files you want to restore on your WordPress site. Remember: you don’t have to completely replace everything if it’s just one part of the site that isn’t working.

Elegant Themes has a short video guide on how to use UpdraftPlus to backup, restore, and migrate WordPress websites. At the 4:09 mark, you can see how easy it is to restore certain aspects of your WordPress site. It presents a great argument for why you might only want to restore something like plugin files instead of the whole site.

When you’re ready, click the Restore button. It will retrieve the relevant files and set to work on replacing not just your files, but your database.

Step 3: Review the Restored Website

Once you receive the success message from the backup plugin, visit the website. Make sure it’s online and in the state you expected it to be (i.e. the state it was in at the restore date and time.)

If you encounter any serious issues, you will need to use your control panel to redo the restore. The steps for that are broken out below.

If you find smaller problems — like broken links where there were none before or images that have gone missing — take heed of Hostinger’s advice. In some cases, it won’t be necessary to go through the trouble of redoing the restoration. You can simply configure settings inside WordPress to set everything up correctly once again.

Restore a WordPress Site Using the Control Panel

Regardless of whether you use your backup plugin to handle the restore, you still need a backup plugin to automate the process of saving copies of the website in the first place.

With that part not up for debate, you need to make a decision about whether a plugin or control panel is best for doing the restore. If you’re at this point in the post, then you need the control panel.

Because a WordPress website is comprised of various parts, you have to upload the corresponding files for each to different parts of the control panel.

Restore the WordPress Core

If you are having problems with the underlying core software (e.g. something seems buggy or you keep seeing a WordPress error you don’t understand), the first thing to do is restore the WordPress core. This also needs to be done if your website has been hacked.

BlogVault explains another reason why you may need to do this:

If you choose to delete all the files and re-install WordPress before you restore your site, it saves you the effort of tracking lingering, unwanted files or permission issues during file overwrites.

Here is what you need to do:

Step 1: Download WordPress Files

To replace the WordPress core files, you can’t use the backup saved in your remote storage. Instead, go to the WordPress.org website.

WordPress.org homepage

Click on Get WordPress in the top-right corner. This will take you to the files for the latest version of WordPress.

Button to download the latest WordPress version

Unzip the folder.

Step 2: Go to Your Control Panel

Log into your web hosting account and navigate to the control panel. You can use the file manager or FTP manager to upload the fresh WordPress core files.

Step 3: Replace Old WordPress Files with New

Navigate to the root of your website.

Old WordPress Files

What you need to do is replace the files and folders there with the clean WordPress files in your unzipped folder:

Unzipped WordPress

Do NOT replace the wp-content folder or wp-config.php file though.

WP Folders

This is just about updating the core software; not the content (i.e. plugins, themes, and uploads).

To be safe, delete all WordPress files and folders (refer to the unzipped file from WordPress if you’re unsure) except the wp-content folder and the wp-config.php file.

Then, upload all of the clean core files to the file manager.

Upload WP Files

Step 4: Upload wp-config.php from WordPress (Optional)

WordPress includes a wp-config-sample.php file with base configurations for the WordPress installation.

wp-config-sample

Any custom configurations you had before will go away when this file is uploaded and takes the place of wp-config.php.

You have two options, depending on the reason for the WordPress restore:

  1. If your website was hacked, delete wp-config.php. Upload the wp-config-sample.php file from WordPress.
  2. If there was a non-security issue on your website, leave the wp-config.php file where it is. There’s no need to replace it.

Once you’ve swapped out all files, save your changes.

Step 5: Adjust Permalinks

Finally, log into your WordPress site and go to Settings > Permalinks.

Selecting Settings - Permalinks from the WordPress sidebar

If your configuration has changed, your Permalinks structure may have changed with it. This would effectively break all the page and post links that have been shared on the web if the default doesn’t match what you previously used. It’ll also break all of your internal links.

WordPress Permalinks settings

Make the update — if needed — and save your changes.

This will complete the refresh of your WordPress installation. Return to your website and verify that the WordPress core restoration resolved the issue. If it did not, proceed to the next restore step.

Restore WordPress Files with FTP or File Manager

To replace the files of your website, remain inside of your FTP or file manager tool.

Now, we’re going to focus on how to exchange the files from your backed-up website to the /wp-content/ folder.

Step 1: Retrieve Your Files Backup

Downloading your backup files from remote storage is easy.

Log into your remote storage service like Amazon S3 and locate where your backups are being stored.

Amazon Buckets

Download all of the zip files from the date you want to restore.

Step 2: Upload Image Files to the File Manager or FTP

Next, unzip your Uploads folder from the backup.

Then, upload your image files and anything else of importance to /wp-content/uploads/.

Visit your website and confirm that it’s still live and everything looks okay.

Step 3: Upload Plugins to the File Manager or FTP

If your WordPress plugins weren’t the reason for the restore, you can upload your Plugins folder from the backup to your /wp-content/plugins/ folder inside the file manager or FTP.

If any of your plugins were the source of the issue, there are a couple of things you can do:

  1. If you know the offending plugin, delete it and all traces of its records from inside your file manager. This will effectively remove it from your website.
  2. If you don’t know which was the offending plugin, change the name of the /plugins/ folder to something like /old-plugins/. Then, log into WordPress and work on installing your plugins one by one. After each is installed, confirm that your website is still okay before moving on.

Again, visit your website to make sure these changes didn’t negatively affect it.

Step 4: Upload Theme(s) to the File Manager or FTP

Unless your WordPress theme was the source of a security breach or performance glitch, you should be able to upload your theme files directly to the file manager or FTP. This is an especially important step if you’ve designed a child theme for your website and you don’t want to rebuild those customizations into the site once more.

To do this, locate the /wp-content/themes/ folder in the file manager or FTP. Replace the current theme files with the ones from your backup.

This should be the last thing you have to do to update the files on your WordPress site. However, if your backup stored any extraneous files for you, be sure to review them and determine whether or not they need to be uploaded as well.

Then, check your website one final time. Confirm that everything looks good and then proceed to the final steps!

Restore the WordPress Database with phpMyAdmin

The WordPress Codex has a guide that briefly details how to restore your database with phpMyAdmin or MySQL/MariaDB commands. If you’d prefer to do the latter, refer to their guide. Otherwise, you can proceed with the following steps:

Step 1: Retrieve Your Database Backup

If you go back to your remote storage account, you’ll see that there’s one backup file saved in a different format from the rest:

Database File

Your database files will be saved with Gzip compression, which is why it has the .gz extension instead of .zip.

Download the file you need and let’s go back to the control panel.

Step 2: Enter phpMyAdmin

The database manager is located inside of phpMyAdmin.

phpMyAdmin Interface

As you can see, it’s a much different interface from your FTP or file manager. That’s because this focuses solely on storing and executing commands against your database tables.

Step 3: Delete the Database

Click on the Databases tab. This will take you to a list of all your databases and their tables. This is where information regarding the content you’ve created, like posts and pages — as well as settings for your plugins and theme — live.

Open your backed-up database file and do a search for “Database: ”. This will tell you the exact name of the database you want to replace.

Once you have the name, locate it in the list of databases and click on the name. This will open the list of tables in the main dashboard. Check all of the tables:

Drop Tables

Then click the “With selected:” dropdown and choose “Drop”.

You’ll be asked if you really want to execute this query. Verify that you’ve chosen the correct database name and accept the changes. This will remove all tables from your database.

Step 4: Upload the Restored Database

With the same (but now empty) database open, click the Import tab at the top of the page.

Import Tables

Locate the .gz file (do not unzip) and click Go at the bottom of the page. This will import your old database tables back into your website.

Make sure you see the success message before exiting. Then, go to your WordPress website and confirm that all content from the restored copy is there and looking as it should.

Wrapping up: Getting Started with Restoring WordPress from a Backup

Backup and restoration can be a nerve-wracking process if you’re not confident in your skills to handle it or if you’re worried that your backup plugin isn’t up to the task.

There’s also the security piece that may have you concerned. What if the version you’re trying to restore was corrupted and you didn’t know it? Or, what if your MySQL password was hijacked, and the restore you just did was for naught as hackers were able to get right back inside?

So, here’s what you need to do:

First, put stricter security practices in place and reduce the likelihood that a restore from backup will ever be needed. Also, be mindful of what you do with plugins and themes on your website. Bad updates can wreak all sorts of havoc, so remembering to handle these in a safe environment will save you heartache.

[bctt tweet=”😎 Putting stricter security practices in place can reduce the likelihood that restoring from a backup will ever be required. #WordPress” username=”thewpbuffs”]

Next, consider outsourcing the responsibility of managing backups and restoring your WordPress site to someone like WP Buffs. With WP Buffs backup service, restorations are as easy as a single click of a button. And if you run into trouble, 24/7 support is provided.

Want to give your feedback or join the conversation? Add your comments 🐦 on Twitter.

If you enjoyed this article, then you’ll really enjoy the 24/7 WordPress website management and support services WP Buffs’ has to offer! Partner with the team that offers every aspect of premium WordPress support services.

From speed optimization services, to unlimited website edits, security, 24/7 support, or even white-label site management for agencies and freelancers, our expert engineers have your back. Bring us in as part of your team to make your site Bufftastic! Check out our plans

Curious about what we do?

NEW!

Download free eBook with advice from experts

By submitting this form, you agree to be contacted by WP Buffs and Equalize Digital. You may unsubscribe from communications at any time using the links provided in all emails.