Import/Export a WordPress Site
This help document will walk you through how to import and export a site to and from Local. It will also go over how to restore from only Local site files.
Import a site using a zip
Local is pretty flexible about being able to import a WordPress site from a zip
archive.
There are two required things that Local needs for the import to be successful:
- The
wp-content
folder (containing plugins, themes, and uploads) - A database dump as a
sql
file
There are a few ways to get a zip backup of your site:
Or backup from a different host using a tool like WP Migrate. Here is a help doc to walk you through the steps of using the free version of WP Migrate Lite.
Once you have your backup, your zip archive will probably look something like this:
note
Note that in this case, the database dump is next to a files folder, which contains the wp-content
folder.
All you need to do is import this zip
file by dragging and dropping it over Local or selecting “Import” from Local’s menu.
Local will ask you a few questions about the site, such as the Site Domain as well as the folder you want to use to hold the site. Depending on the size of the archive, the import can take a few seconds for smaller sites, or much longer if the zip
file is quite large.
Manually Import a Local site
If you’re getting errors when importing a zip file, you could attempt a manual import using these steps:
- Unzip the file in a common location, like the desktop.
- Create a new, blank site in Local. Use whatever username/password you like since you’ll be overwriting the Database.
- The
wp-content
folder that is created with the new blank site you can renamewp-content-old
or just delete it. Copy thewp-content
folder from your backup to the newly created site’s location to take its place. - Copy the correct SQL file to the site root (App>Public).
- Within Local, click
Open Site Shell
- Import your Database with
wp db import your-database-filename.sql
- If that works, now Search and replace the domains. This might require more than one S/R, for example:
wp search-replace production.com mysite.local
wp search-replace https://mysite.local http://mysite.local
Restore from only Local site files
There are some cases where you might need to re-import a site into Local using only the files contained within the site folder. Power failure or breaking changes caused by a system update can force you to restore a backup of your Local WordPress sites.
If you can get the Local site folder from a system restore point or a time-machine backup and it has both the WordPress files as well as the sql
files, then you have everything you need to re-import the site!
To give some context, you would want to zip
the whole site folder, including the app
and logs
folders. Using the following screenshots as an example, you would zip up the wordpress-import
folder, and then use the wordpress-import.zip
file to import into Local by dragging and dropping the archive over Local.
Export a site
Start by opening “Local” and ensure that the site you want to export is running. Next, right-click on the site and select “Export.” Follow the prompts to save the website in a place that you can find it like the Desktop!
The zip
file that is created contains everything you need for the site, including Media, Plugins, Themes, and an export of the database! The export is the entire /wp-content folder and the database.