Manually Restore Your Site from a Jetpack Backup File on WordPress.com
It is often possible to restore your site with a click of a button using Jetpack VaultPress Backup, but there may come a time when you need to manually restore a version of your site using a backup file you have previously downloaded.
If you manage a WordPress.com site whose Business or Commerce plan recently expired, first try following these steps, as your site’s backups may still be available for one-click restoration.
If you’re transferring files to a new domain (i.e. if the files you’re importing used to live on a different domain than the one you’re now using), be sure to follow the instructions for updating your domain in your database below. If you’re restoring your files to a site with the same domain, you may skip that step.
Transfer Plugins, Themes, Uploads, and Database Files
You can manually restore your WordPress.com site using a Jetpack .tar.gz
backup file by following the video (~3 minutes) or steps below:
- You must have an active WordPress.com Business or Commerce plan in order to follow these instructions.
- Enable SFTP credentials for your WordPress.com Business or Commerce plan by following these instructions. You’ll also need to connect to SFTP using an SFTP client. We’ll use FileZilla during this tutorial.
- Unzip your
.tar.gz
file. On Mac, you can double-click the file. On Windows, you can use an archiving tool (like 7-Zip). The unzipped folder will contain your site data in the following sub-folders:wp-content
(which contains yourplugins
,themes
, anduploads
folders) and.sql
. - Once FileZilla is connected to your site, go to the
/srv/htdocs
folder. Within that folder, openwp-content
. - Open the
plugins
folder, and you’ll see a list of plugins currently installed on your site.- About symlinked files and folders: On a WordPress.com website, we symbolically link (symlink) WordPress Core files as well as WordPress.com’s own themes and plugins. By using symlinks, we can ensure that the files on your website are always up-to-date and secure.
- To identify a symlinked folder or file, some FTP clients may show a tiny arrow on the bottom-left part of the folder icon. On others, it might have a question mark over it.
- You won’t be able to access or edit the symlinked files, as they are managed on the platform level.
- Learn more about symlinked folders and files here.
- About symlinked files and folders: On a WordPress.com website, we symbolically link (symlink) WordPress Core files as well as WordPress.com’s own themes and plugins. By using symlinks, we can ensure that the files on your website are always up-to-date and secure.
- Check the
plugins
folder from your backup and compare it to theplugins
folder you have in FileZilla. Any plugin can be restored by dragging the entire plugin folder from your backup to FileZilla, provided the plugin is not symlinked. Skip any symlinked plugins, and transfer any others you wish to restore on your site. - Repeat this process with your
themes
anduploads
folders. - Next, you’ll need to restore your database files. Drag the
sql
folder from your backup into thehtdocs
folder on FileZilla. - Open the Terminal on your computer and connect to your site via SSH.
- Once connected, type
cd htdocs/sql
, then press return/enter on your keyboard. - Type
ls | xargs -I % wp db import %
, then press return/enter on your keyboard.- This lists every file in the folder, wraps the files, and then runs
wp db import
all with one command.
- This lists every file in the folder, wraps the files, and then runs
- Run
wp cache flush
, then press return/enter on your keyboard.- You must flush the cache every time you make changes to your database.
Any plugin or theme settings you had enabled at the time of your backup should now be enabled on your site.
Update Your Domain in the Database
When restoring your site to a different domain, you’ll need to update all mentions of your old domain in the database. If you’re restoring your site files to a site with the same domain, you should skip this section.
You can edit your newly-imported database using phpMyAdmin or WP-CLI.
Update siteurl
and home
Values with phpMyAdmin
To update your siteurl
and home
database values in the wp_options
table using phpMyAdmin:
- Visit your site’s dasard and navigate to Hosting → Overview (or Settings → Hosting Configuration if using the default interface style).
- Click the Server Settings tab.
- Click the Open phpMyAdmin button.
- To view your siteurl and home values, click the SQL button in the top toolbar, and run the following queries:
/* Run these queries to get your current site URL */
SELECT * FROM `wp_options` WHERE `option_name` = 'siteurl';
SELECT * FROM `wp_options` WHERE `option_name` = 'home';
- To update your
siteurl
andhome
values, click the SQL button in the top toolbar and run the following queries, replacing NEW-DOMAIN with your new domain:
/* Run these queries to update your site URL to your new domain */
UPDATE wp_options SET option_value = 'NEW-DOMAIN' WHERE wp_options.option_name = 'siteurl';
UPDATE wp_options SET option_value = 'NEW-DOMAIN' WHERE wp_options.option_name = 'home';
Search and Replace with phpMyAdmin
To ensure that images load as expected, you should also run search-replace queries to update any references to your old URL:
- Visit your site’s dasard and navigate to Hosting → Overview (or Settings → Hosting Configuration if using the default interface style).
- Click the Server Settings tab.
- Click the Open phpMyAdmin button.
- Click the SQL button in the top toolbar, and run the following queries, replacing OLD-DOMAIN with your old domain name and NEW-DOMAIN with your new domain name:
/* Run these queries to update the old domain to your new domain */
UPDATE wp_posts SET post_content = replace(post_content, 'OLD-DOMAIN', 'NEW-DOMAIN');
UPDATE wp_posts SET guid = replace(guid, 'OLD-DOMAIN','NEW-DOMAIN');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'OLD-DOMAIN','NEW-DOMAIN');
UPDATE wp_links SET link_image = replace(link_image, 'OLD-DOMAIN','NEW-DOMAIN');
Update siteurl
and home
Values with WP-CLI
To update your siteurl
and home
database values in the wp_options
table using WP-CLI:
- Open the Terminal on your computer and connect to your site via SSH.
- Once connected, type
cd htdocs/sql
, then press return/enter on your keyboard. - To view your
siteurl
andhome
values, run the following commands one at a time:wp option get siteurl
wp option get home
- To update your
siteurl
andhome
values, run the following commands one at a time, replacing NEW-DOMAIN with your new domain:wp option update siteurl NEW-DOMAIN
wp option update home NEW-DOMAIN
- Run
wp cache flush
, then press return/enter on your keyboard.
Search and Replace with WP-CLI
To ensure that images load as expected, you should also run a search-replace command to update any references to your old URL:
- Open the Terminal on your computer and connect to your site via SSH.
- Run the following command, replacing OLD-DOMAIN with your old domain name and NEW-DOMAIN with your new domain name:
wp search-replace OLD-DOMAIN NEW-DOMAIN --skip-columns=guid
- Run
wp cache flush
, then press return/enter on your keyboard.
Frequently Asked Questions
What if something goes wrong?
If something unwanted happens to your site as a result of actions in SFTP, in phpMyAdmin, or with WP-CLI, you can restore a recent backup of your site. If you’re still having trouble, connect with our Happiness Engineers here.
Last updated: August 05, 2024