Do you use ManageWP to manage both the staging and live site, but each time the staging site is pushed to live site it disconnects the live site from ManageWP?
You can prevent this by telling WP Staging Pro to keep the manageWP connection data while pushing the staging site to live.
To do that, download and install the WP Staging hooks plugin from here: https://github.com/WP-Staging/wp-staging-hooks
You can find more about that plugin here:
https://wp-staging.com/docs/actions-and-filters/
You can either do the changes manually or you can use the code below that we’ve already completed. Just copy the code and add it to a file on your site into the folder:wp-content/plugins/wp-staging-hooks/wp-staging-hooks.php
Manual modifications
If you already use the WP Staging Hooks plugin please follow the instructions below to modify it:
In the WP Staging hooks source code, you will find a function named wpstg_push_options_excl()
and an action named wpstg_preserved_options
To activate it uncomment the line//add_action( 'wpstg_preserved_options', array($this, 'wpstg_push_options_excl'), 10 );
to
add_action( 'wpstg_preserved_options', array($this, 'wpstg_push_options_excl'), 10 );
Then change the function to:
function wpstg_push_options_excl($options){
$moreOptions = array(
'mwp_service_key',
'mwp_openssl_parameters',
'mwp_incremental_update_active',
'mwp_public_keys_refresh_time',
'mwp_public_keys',
'mwp_communication_keys',
'mwp_key_last_used_d1d69698-e538-4af7-8804-4a6c9dbd498b',
'mwp_key_last_used_4799204',
'mwp_new_communication_established',
'_site_transient_mwp_sessions',
'mwp_last_communication_error',
'mwp_key_last_used_cb89c08f-0b91-4865-a9f7-90dbb74be66c',
'mwp_key_last_used_5594417',
'mwp_key_last_used_5ecf7cac-4e8b-43da-98d1-e1e379938e7e',
'mwp_key_last_used_7b9c9bd6-f0da-4c4e-a33f-02f230ae65a5',
'mwp_recovering',
'mwp_service_key',
'mwp_core_autoupdate',
'mwp_container_parameters',
'mwp_container_site_parameters',
'mwp_maintenace_mode',
'mwp_worker_configuration',
'mwp_key_last_used_d6868e04-ec36-40e7-8bab-485838cb5df6',
'mwp_key_last_used_bd3efed8-231b-4c0d-95a5-6964682a9498',
'mwp_communication_key',
'mwp_worker_brand',
'mwp_potential_key',
'mwp_potential_key_time',
'mwp_service_key'
);
return array_merge($options, $moreOptions );
}
You also need to exclude the ManageWP worker plugin from being copied from staging to live. You can either exclude it manually before your push the staging site or you can change the function wpstg_exclude_folders_custom()
function wpstg_exclude_folders_custom($args){
$folders = array('worker');
return array_merge($args, $folders);
}
add_filter('wpstg_push_excl_folders_custom', 'wpstg_exclude_folders_custom');
Make also sure that you uncomment the line
//add_action( 'wpstg_push_excl_folders_custom', array($this, 'wpstg_push_directories_excl'), 10 );