Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:

Issues with WPML key registration in migrations between staging and production environments.

I am trying to push changes from the staging to the dev environment (to update the site's content in this environment) and from staging (to prod to publish new tested content).

However, I got this message every time we push the changes from staging to prod:

“This site has moved to a new location
You or someone else moved this site to https://staging.my-domain.com. Please keep in mind that:
Translations that you do at https://staging.my-domain.com will not appear on this site.
You cannot edit translations on this site.
The site at https://staging.my-domain.com is using the same credits for automatic translation as this site.

If you didn't intend to move this site to https://staging.my-domain.com, you can indicate that this site should be at https://dev.my-domain.com.”

Solution:

To fix it please follow these steps:-

1. Make sure you have a complete DB backup of site.

2. Run this query on the database:

select *
from wp_options
where option_name = 'WPML_SITE_ID:ate'
OR option_name = 'WPML_TM_AMS'
OR option_name = 'otgs_wpml_tm_ate_cloned_site_lock'

replace "wp_options" with the correct table name.

3. Delete those entries.

4. Go to WPML > Settings and select use the advanced translation Editor + save and wait for ATE to get activated.

5. Use this guide to link production and staging if needed:

https://wpml.org/documentation/automatic-translation/automatic-translation-subscription-for-multiple-sites/

Also, next time If possible, you can preserve the values of "WPML_SITE_ID:ate", "WPML_TM_AMS", "otgs_wpml_tm_ate_cloned_site_lock" in the wp_options table. These are three option keys that trigger the notice.

Note that you must do it before WPML request to the server i.e. change the value even before you load the site after DB restoration.

We are still working on both issues, and I hope it will be improved in future versions.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 4 replies, has 4 voices.

Last updated by Sumit 1 year, 6 months ago.

Assisted by: Itamar.

Author Posts
October 5, 2023 at 3:19 am #14516175

o-i-wpml

I am trying to push changes from staging to dev environment (to update the site's content in this environment) and from staging (to prod to publish new tested content).

However, I got this message every time we push the changes from staging to prod:

“This site has moved to a new location
You or someone else moved this site to hidden link. Please keep in mind that:
Translations that you do at hidden link will not appear on this site.
You cannot edit translations on this site.
The site at hidden link is using the same credits for automatic translation as this site.

If you didn't intend to move this site to hidden link, you can indicate that this site should be at hidden link

Link to a page where the issue can be seen:
hidden link

We had resolved this issue before we moved to WPEngine hosting. This platform copies the entire file system and the database to the destination environment, and it makes some replacements on the wp-config.php file and the database to fix the domain mismatches.

Since the wp-config.php is (almost) the same for the three environments, I've implemented some PHP code to dynamically define the environment variables according to the hostname and set its respective OTGS_INSTALLER_SITE_KEY_WPML for each one. (Based on this documentation, https://wpml.org/faq/automatic-wpml-registration-using-php-for-easy-moves-between-production-development-and-staging/)

# Custom settings by environment
if (strpos($_SERVER['HTTP_HOST'], 'localhost') !== false) {
	// LOCALHOST: use local development keys

	# Security Salts, Keys, Etc
	define('AUTH_KEY',         '******');
	define('SECURE_AUTH_KEY',  '******');
	define('LOGGED_IN_KEY',    '******');
	define('NONCE_KEY',        '******');
	define('AUTH_SALT',        '******');
	define('SECURE_AUTH_SALT', '******');
	define('LOGGED_IN_SALT',   '******');
	define('NONCE_SALT',       '******');
	define('OTGS_INSTALLER_SITE_KEY_WPML',	'abcabcabca'); // Override WPML site key for this environment (<em><u>hidden link</u></em>)

	# Site host, environments, Etc
	define('WP_ENVIRONMENT_TYPE', 'development');
	define('WP_SITEURL', '<em><u>hidden link</u></em>');
	define('WP_HOME', '<em><u>hidden link</u></em>');
	define('DOMAIN_CURRENT_SITE', 'localhost');

} elseif (strpos($_SERVER['HTTP_HOST'], 'dev') !== false) {
	// DEV: use development keys

	# Security Salts, Keys, Etc
	define('AUTH_KEY',         '******');
	define('SECURE_AUTH_KEY',  '******');
	define('LOGGED_IN_KEY',    '******');
	define('NONCE_KEY',        '******');
	define('AUTH_SALT',        '******');
	define('SECURE_AUTH_SALT', '******');
	define('LOGGED_IN_SALT',   '******');
	define('NONCE_SALT',       '******');
	define('OTGS_INSTALLER_SITE_KEY_WPML',	'abcabcabca'); // Override WPML site key for this environment (<em><u>hidden link</u></em>)

	# Site host, environments, Etc
	define('WP_ENVIRONMENT_TYPE', 'development');
	define('WP_SITEURL', '<em><u>hidden link</u></em>');
	define('WP_HOME', '<em><u>hidden link</u></em>');
	define('DOMAIN_CURRENT_SITE', 'dev.o-i.com');

} elseif (strpos($_SERVER['HTTP_HOST'], 'staging') !== false) {
	// STG: use staging keys

	# Security Salts, Keys, Etc
	define('AUTH_KEY',         '******');
	define('SECURE_AUTH_KEY',  '******');
	define('LOGGED_IN_KEY',    '******');
	define('NONCE_KEY',        '******');
	define('AUTH_SALT',        '******');
	define('SECURE_AUTH_SALT', '******');
	define('LOGGED_IN_SALT',   '******');
	define('NONCE_SALT',       '******');
	define('OTGS_INSTALLER_SITE_KEY_WPML',	'bcabcabcab'); // Override WPML site key for this environment (<em><u>hidden link</u></em>)
	
	# Site host, environments, Etc
	define('WP_ENVIRONMENT_TYPE', 'staging');
	define('WP_SITEURL', '<em><u>hidden link</u></em>');
	define('WP_HOME', '<em><u>hidden link</u></em>');
	define('DOMAIN_CURRENT_SITE', 'staging.o-i.com');

} else {
	// PROD: use production keys

	# Security Salts, Keys, Etc
	define('AUTH_KEY',         '******');
	define('SECURE_AUTH_KEY',  '******');
	define('LOGGED_IN_KEY',    '******');
	define('NONCE_KEY',        '******');
	define('AUTH_SALT',        '******');
	define('SECURE_AUTH_SALT', '******');
	define('LOGGED_IN_SALT',   '******');
	define('NONCE_SALT',       '******');
	define('OTGS_INSTALLER_SITE_KEY_WPML',	'cabcabcabc'); // Override WPML site key for this environment (<em><u>hidden link</u></em>)

	# Site host, environments, Etc
	define('WP_ENVIRONMENT_TYPE', 'production');
	define('WP_SITEURL', '<em><u>hidden link</u></em>');
	define('WP_HOME', '<em><u>hidden link</u></em>');
	define('DOMAIN_CURRENT_SITE', 'prod.o-i.com');

}

However, the alert is still appearing on all environments after pushing the changes.

Is there any other variable that we need to set?

October 5, 2023 at 8:25 pm #14523131

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

I would suggest that you merge those site so that you will not longer run into this issue:

https://wpml.org/documentation/automatic-translation/automatic-translation-subscription-for-multiple-sites/

This way both sites can use the same credits or subscription for credits and share the same translation memory and glossary on the Advanced Translation Editor.

Let us know if further assistance is needed.

Best regards
Andreas

October 6, 2023 at 4:26 pm #14530187

o-i-wpml

Thank you, Andreas, for your reply.

I cannot connect other sites because WPML Translation Manager page is disabled for those unconnected sites.

How could I connect them? Is there another way to get the migration code?

dev.o-i.com_wp-admin_admin.php_page=tm2Fmain.php&sm=ate-ams(Laptop HD) (1).png
October 8, 2023 at 4:49 pm #14535145

Itamar
WPML Supporter since 02/2016

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

I'll continue to help you with this issue. I'm consulting our second-tier supporters about your case and will update you here once I have their reply.

Regards,
Itamar.

October 9, 2023 at 3:50 pm #14541409

Sumit
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

I am Sumit I am working on this issue.

When you move the site from staging to live and live to staging the ATE settings are copied too. Due to this, you see this notice.
We have an internal ticket and this may be improved in future versions to provide a more dynamic solution.

For now, what you can do you can keep the one staging site and one live site by following this article https://wpml.org/documentation/automatic-translation/automatic-translation-subscription-for-multiple-sites/ you can connect them.
Since you are blocked because of this notice we will reset the connection. Please check this errata that explains why it happens https://wpml.org/errata/this-site-has-moved-to-a-new-location-message-after-migrating-your-website/

To fix it please follow these steps:-

1. Make sure you have a complete DB backup of site.
2. Run this query on the database:

select *
from wp_options
where option_name = 'WPML_SITE_ID:ate'
OR option_name = 'WPML_TM_AMS'
OR option_name = 'otgs_wpml_tm_ate_cloned_site_lock'

replace "wp_options" with the correct table name.
3. Delete those entries.
4. Go to WPML > Settings and select use the advanced translation Editor + save and wait for ATE to get activated.
5. Use this guide to link production and staging if needed: https://wpml.org/documentation/automatic-translation/automatic-translation-subscription-for-multiple-sites/

Also, next time If possible you can preserve the values of "WPML_SITE_ID:ate", "WPML_TM_AMS", "otgs_wpml_tm_ate_cloned_site_lock" in the wp_options table. These are three option keys that trigger the notice.

Note that you must do it before WPML request to the server i.e. change the value even before you load the site after DB restoration.

We are still working on both issues and I hope it will be improved in future versions.

Thanks

October 10, 2023 at 1:38 am #14543265

o-i-wpml

Thank you Sumit,

I've followed your steps, and it worked for me. However, I'll need to repeat this process in a daily basis.

I hope you automate this process soon in the next update. It would be great for us and for all other companies that work with the WP Engine environments.

Thank you again and have a wonderful day!