{"id":7998999,"date":"2021-02-03T16:57:26","date_gmt":"2021-02-03T16:57:26","guid":{"rendered":"https:\/\/wpml.org\/?post_type=faq&#038;p=7998999"},"modified":"2023-09-08T06:06:46","modified_gmt":"2023-09-08T06:06:46","slug":"automatic-wpml-registration-using-php-for-easy-moves-between-production-development-and-staging","status":"publish","type":"faq","link":"https:\/\/wpml.org\/vi\/faq\/automatic-wpml-registration-using-php-for-easy-moves-between-production-development-and-staging\/","title":{"rendered":"How can I automate WPML registration using PHP for easy moves between production, development, and staging?"},"content":{"rendered":"<p class=\"lead\">If you are frequently moving the database between production, development, and staging, you can set the site key in the <strong>wp-config.php<\/strong> file. This method allows you to avoid re-entering the site key when moving the database between different environments. By generating a unique site key for each domain and adding them to their respective <strong>wp-config.php<\/strong> files, you eliminate the need to register WPML manually.<\/p>\n<p><!---more---><\/p>\n<h2>How do I set a different site key for each environment?<\/h2>\n<p>To set a different site key per environment:<\/p>\n<ol>\n<li>Generate a different site key for each of the different domains of the site. Go to your <a href=\"https:\/\/wpml.org\/account\/\">Account page<\/a> to generate the site keys.<\/li>\n<li>Add the different site keys to each of the environments in their respective <strong>wp-config.php<\/strong> files, using the following statement:<\/li>\n<\/ol>\n<p><code>define( 'OTGS_INSTALLER_SITE_KEY_WPML', 'your-site-key' );<\/code><\/p>\n<p>The value that you set using the OTGS_INSTALLER_SITE_KEY_WPML takes precedence over the value in the database. So, when you move the database between domains, you will not need to update the registration.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are frequently moving the database between production, development, and staging, you can set the site key in the wp-config.php file. This method allows you to avoid re-entering the site key when moving the database between different environments. By generating a unique site key for each domain and adding them to their respective wp-config.php [&hellip;]<\/p>\n","protected":false},"author":353313,"featured_media":0,"menu_order":60,"template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"ep_exclude_from_search":false,"footnotes":""},"faq-category":[26127],"class_list":["post-7998999","faq","type-faq","status-publish","hentry","faq-category-getting-started"],"_links":{"self":[{"href":"https:\/\/wpml.org\/vi\/wp-json\/wp\/v2\/faq\/7998999","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpml.org\/vi\/wp-json\/wp\/v2\/faq"}],"about":[{"href":"https:\/\/wpml.org\/vi\/wp-json\/wp\/v2\/types\/faq"}],"author":[{"embeddable":true,"href":"https:\/\/wpml.org\/vi\/wp-json\/wp\/v2\/users\/353313"}],"version-history":[{"count":8,"href":"https:\/\/wpml.org\/vi\/wp-json\/wp\/v2\/faq\/7998999\/revisions"}],"predecessor-version":[{"id":14363541,"href":"https:\/\/wpml.org\/vi\/wp-json\/wp\/v2\/faq\/7998999\/revisions\/14363541"}],"wp:attachment":[{"href":"https:\/\/wpml.org\/vi\/wp-json\/wp\/v2\/media?parent=7998999"}],"wp:term":[{"taxonomy":"faq-category","embeddable":true,"href":"https:\/\/wpml.org\/vi\/wp-json\/wp\/v2\/faq-category?post=7998999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}