How to Convert WordPress Staging Site to Production Site with WP Staging basic version
If you like to do the migration automatically with
WP Staging Pro read that article.
This tutorial explains how to migrate manually your site by using WP Staging basic version.
Read the instructions below very carefully and do not miss any step!
Note: The video below shows WP Staging Pro pushes your staging site to the production website.
The WP Staging free version, on the other hand, needs a few manual steps to do it. So let’s get started with using WP Staging free version to convert the staging site to the production one.
Goal: After reading this tutorial you are able to convert your existing staging site to the live website.
Limitations: Contrary to the use of WP Staging Pro the manual process makes your staging site unavailable and you need to create a new one after finishing the whole process.
How to Move Over Complete Staging Site to Production
Requirements for this tutorial:
- One live site which is in production use e.g. https://host.com
- One staging site which you previously created with WP Staging or WP Staging Pro. Staging site should be located in a subfolder like https://host.com/staging
- Plugin WP Staging activated on live site
- Plugin Better Search Replace activated on live site
(Not needed for WP Staging Pro)
- Plugin BackWPup (or any other backup software) installed on live site
1. Step – Backup Live and Staging Site
At first, backup the entire production and staging site.
I recommend the BackWPup plugin which is a great and very reliable backup tool. Even the free version allows to backup files to FTP, Amazon S3 storage or to a folder on the server.
I do not explain the use of BackWPup here but it is very self-explanatory.
Note: At the file selection dialog of BackWPup make sure to select and include the WP Staging subfolder of the staging site. This is important to make a backup copy of your staging site as well. Also, include all database tables beginning with the prefix wpstg_
2. Step – Copy Files
Use an FTP program like Filezilla and copy over the folders
wp-content/themes from your staging site subfolder to the production site.
3. Step – Migrate the Database
You have three options to migrate the database data of the staging site so that it will be used by the production site’s database:
- Option 1: – Very easy: Use WP Staging Pro and clone the entire staging site automatically to live by clicking one button, only.
- Option 2 – Easy: Go this route and do some manual search & replace operation in the staging site database tables and tell WordPress to use the staging database tables for the production site. The database tables of the live site will not be overwritten, nor any of its data will be deleted. You can switch over to the original database tables anytime in case something is not working as intended. Read step 3.1
- Option 3 – Advanced: Use a separate DB migration plugin like wp migrate db or any other plugin that can do a migration of the staging site database to live.
3.1. Convert Staging DB Tables to Live Database
This is the easiest way and recommended if you do not care that the live site will use the staging site database tables after the conversion process.
Note: After doing that your staging site will not be available any longer and you need to create a new one.
At first, you need to do a search and replace over the staging database tables.
Find all strings containing the path to the staging site and replace them with strings leading to the live site.
Fortunately, there is a nice plugin we can use to do this step without the need for manual interaction. If you haven’t already installed the plugin Better Search Replace
Next, Go to Tools > Better Search Replace
We assume that your staging site is located in http://yoursite.com/staging
You can test this by opening the staging site and checking the complete URL in the browser window.
- Enter the following string into the Search for input field
Enter the string below into the Replace with field
Make sure to work accurately. Enter exact strings!
– Do not enter any trailing slash after the URL!
– Do not add http:// or https:// to the search string
Any misspelling will lead to a broken staging or even live site.
Next, select all the tables which begin with the table prefix of the staging site. Usually, these ones begin with wpstg*_
You can find out the correct table prefix by looking into the list of staging sites:
If you are using an older version of WP Staging you need to check out the table prefix by looking into the wp-config.php of the staging site:
To do so just open the file below by logging in with FTP to your website:
All other tables belong to the live site or to other staging sites which must not be altered in any way!
In the next step, you can select the dry-run option. This allows to run the search and replace process without changing any real data and is a good indicator if the provided settings are correct and if the search and replace plugin is working as expected.
Click on the Run Search/Replace button.
Remove database value wpstg_is_staging_site
The next step is to delete the value in the database which defines if a database table belongs to the staging site or to the live site. This is used by WP Staging to show the authentication screen.
Use a database administration tool of your choice e.g. phpmyadmin or adminer and search the database tables of the staging site for the value
Delete this value or set it to false.
If you did this successfully you just need to finish another step and you are done:
The last step is to tell the WordPress live site to use the database tables of the staging site.
For this, you need an FTP account to access your website and an FTP client. I recommend the use of FileZilla. It’s entirely free and open source.
Login to your live website with the FTP client program and open the config file of your live site.
The file is located in
Open the file in edit mode by opening the context menu with the right mouse button and select edit
Change the value of
$table_prefix to the same value that is used by the staging site, e.g.
$table_prefix = 'wpstg1_';
The end result in your editor will look like this:
This tells your production site to use all the database tables of the staging site.
Now open the live site and you will see that it displays all the content from the staging site.
If you like to enable permalinks you just need to login to the admin dashboard and enable permalinks from Settings > Permalinks
Now, the live site uses the staging site database and all the content from the staging site has been moved over to the live site.
The last step is to delete the old staging subfolder by using FTP:
You are done. That’s it.
Important: As the staging site database tables will be used by the production site you need to create a new staging site when you are done.
The old staging site cannot be used any longer!