{"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\/he\/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,"_uag_custom_page_level_css":"","ep_exclude_from_search":false,"footnotes":""},"faq-category":[26127],"class_list":["post-7998999","faq","type-faq","status-publish","hentry","faq-category-getting-started"],"spectra_custom_meta":{"_subscription_coupon_product_id":["0"],"_wpml_word_count":["192"],"_wpv_contains_gutenberg_views":[""],"_views_template":["0"],"_edit_lock":["1694153214:76577"],"_edit_last":["76577"],"_wpml_media_featured":["1"],"_wpml_media_duplicate":["1"],"_alp_processed":["1694153207"],"_wpml_location_migration_done":["1"],"faq_order":["10"],"wpcf-faq-category":["1"],"_yoast_wpseo_content_score":["90"],"_yoast_wpseo_estimated-reading-time-minutes":[""],"_oembed_c4c4fb99b23e8039596f64010f555d7a":["<iframe title=\"WPML Embedded Installer for Authors\" width=\"525\" height=\"394\" src=\"https:\/\/www.youtube.com\/embed\/vdVNiV8_evQ?feature=oembed&enablejsapi=1&origin=https:\/\/wpml.org\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>"],"_oembed_time_c4c4fb99b23e8039596f64010f555d7a":["1643285686"],"_yoast_wpseo_wordproof_timestamp":[""],"_yoast_wpseo_primary_faq-category":[""],"_uag_css_file_name":["uag-css-7998999.css"]},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"gform-image-choice-sm":false,"gform-image-choice-md":false,"gform-image-choice-lg":false,"woocommerce_thumbnail":false,"woocommerce_single":false,"woocommerce_gallery_thumbnail":false},"uagb_author_info":{"display_name":"Allison Rivers","author_link":"https:\/\/wpml.org\/he\/author\/allison-r\/"},"uagb_comment_info":0,"uagb_excerpt":"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;","_links":{"self":[{"href":"https:\/\/wpml.org\/he\/wp-json\/wp\/v2\/faq\/7998999","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpml.org\/he\/wp-json\/wp\/v2\/faq"}],"about":[{"href":"https:\/\/wpml.org\/he\/wp-json\/wp\/v2\/types\/faq"}],"author":[{"embeddable":true,"href":"https:\/\/wpml.org\/he\/wp-json\/wp\/v2\/users\/353313"}],"version-history":[{"count":8,"href":"https:\/\/wpml.org\/he\/wp-json\/wp\/v2\/faq\/7998999\/revisions"}],"predecessor-version":[{"id":14363541,"href":"https:\/\/wpml.org\/he\/wp-json\/wp\/v2\/faq\/7998999\/revisions\/14363541"}],"wp:attachment":[{"href":"https:\/\/wpml.org\/he\/wp-json\/wp\/v2\/media?parent=7998999"}],"wp:term":[{"taxonomy":"faq-category","embeddable":true,"href":"https:\/\/wpml.org\/he\/wp-json\/wp\/v2\/faq-category?post=7998999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}