There are a number of ways to transfer a WordPress installation.
If you are trying to copy a live site to a testing environment, the easiest way is to do the following:
- From the live site, go Tools < Export. This will download an xml file that contains the contents of the database: posts, pages, menus, users, comments, etc.
- In the testing environment, go Tools < Import. You will be asked to install the WordPress importer plugin, if it’s not already on your system.
- When prompted, browse to the xml file you downloaded from the live site and upload it.
- Here you will be asked if you want to import the users from the live site. You can do this, or assign posts to users in the testing environment
- Finally, if the live site has media, click on “download attachments.”
This is a quick and easy transfer. However, there are a few drawbacks:
- Your live site’s plugins, themes, etc will need to be manually installed in the testing environment. The Tools<Export method doesn’t deal with these things.
- Your menus and possibly widgets will need to be reset.
- The database id numbers won’t match. This can be a problem if your theme or added CSS have styled by post-number (but that is generally a bad idea anyway).
- If trying to copy a testing environment to a live site, the “download attachments” option will fail because the live site isn’t open to the Internet.
For these reasons and others, the Duplicator plugin is one of the most valuable WordPress plugins. It will allow you to make a perfect copy of a site.
For this exercise, I will demonstrate how to use Duplicator in class.
Then I would like you to do the following:
- Copy a live site to a testing environment at localhost:8888/liveduplicate
- Copy a testing site to a NEW live site (such as the “Canada” sample site”).
To do this, you need to make a new database in your host company’s control panel. Do not overwrite an existing database.
Make that site at http://yourdomain.com/publishingclass/testingduplicate
Once you’ve shown me both the testing and the live site, figure out how to remove the duplicate installation from your live domain.
The Pro Version of Duplicator adds the ability to schedule copies of your sites (note the plural) and have those Duplicator archives sent to cloud storage options such as Dropbox, Google Drive, Amazon S3, or elsewhere.
It is, in other words, an excellent backup option.