Print

Reconnect Staging Site to Production Website

Under rare circumstances, the connection between the staging and the production site may get lost, and you need to connect the staging site again with the production website.

Under  WP STAGING > Sites, you will see that your staging site is not listed any longer.

The missing site’s page looks like this:

This can happen when you manually migrate your staging site to live or delete the database row containing the WP STAGING settings.

It also happens if you’ve restored your production site from an earlier backup that did not contain the latest staging site settings data.

This can also happen if you moved your production and staging site to another server.
Read here to find out how to reconnect the staging site in that case.

Another reason for this could be if you created your staging site with an ancient WP Staging version like 1.6 or earlier and then upgraded to the latest WP STAGING Pro version.

If WP STAGING lost its connection to the staging site, it’s impossible to push the staging site to the production website any longer.

Reconnect Existing Staging Site with Production Site

The easiest way to fix this is to follow these steps:

Go to WP STAGING Pro > Tools and search for ABSPATH.

Copy the ABSPATH value and go to WP STAGING Pro > Sites.

Find your targeted staging site and click on Edit Data:

Enter the target directory path ending with the name of your staging site in lowercase:

Don’t change the Database Access Data!

Click on “Save Clone Data”

Now you should be able to properly push your staging site.

Reconnect Manually By Editing the Database

If you are familiar with PHPMyAdmin and are not scared of modifying the production database, you can reconnect your staging site by changing the database’s relevant data.

As long as you change the mentioned values only,  you cannot break anything. It’s still a good idea to make a backup first!

WP Staging stores all its staging sites as serialized data in the table wp_options and in the row with the option_name wpstg_existing_clones_beta

  • So, create first a new staging site!
    Give it any name but not the same name as the staging site you like to connect to.
    You can exclude all files and database tables to speed up the cloning process!

This will create a data set like this in the table. wpstg_existing_clones_beta

a:1:{s:4:"test";a:13:{s:13:"directoryName";s:4:"test";s:4:"path";s:44:"/srv/www/wordpress-default/public_html/test/";s:3:"url";s:32:"http://local.wordpress.test/test";s:6:"number";i:1;s:7:"version";s:5:"2.8.3";s:6:"status";b:0;s:6:"prefix";s:7:"wpstg0_";s:8:"datetime";i:1556125383;s:12:"databaseUser";s:0:"";s:16:"databasePassword";s:0:"";s:16:"databaseDatabase";s:0:"";s:14:"databaseServer";s:9:"localhost";s:14:"databasePrefix";s:3:"wp_";}}

Get this data and copy it.

As you can see, this data set is for a staging site with the following parameters:

  • name test
  • Directory location  /srv/www/wordpress-default/public_html/test/
  • URL http://local.wordpress.test/test

As this is a serialized data set, you can not do a simple search & replace, and you need to follow the instructions below carefully:

  • Open PHPMyAdmin and look for the option_name wpstg_existing_clones_beta  in the database table wp_options.
  • Get the value of that column and copy it into an empty text file for backup purposes.

  • The next step is to open the PHP serialized data online editor from the link below and paste the data into the input-form 1 (Paste in serialized PHP here)
    http://sciactive.com/phpserialeditor.php

  • Now, change the path to the staging site in the input form 2 to your staging site’s new location!

You can get the destination by looking into the system info at
WP Staging > tools > system info
and finding the value ABSPATH.

  • This is the path to the root directory of your WordPress website.
    Just add the subfolder name of the staging site, and you’ll get the full path to your staging site:

  • Go back to PHPMyAdmin and paste the modified serialized PHP data back into the field, wpstg_existing_clones_beta.
    Overwrite the value and save it.

    Now WP Staging is connected again to your staging site, and you can migrate your staging site to live by going to WP Staging > Sites

if you struggle with these steps, get in contact with us, and we’ll help you with it.

Updated on February 11, 2021