I have this code in the head tag of the site and I want to execute only in the production site. It works locally but it is totally ignored once placed in the site, meaning the script is always executed. There are other pieces of code working with php in the head tag validating scripts and they work fine but this one doesnt do anything to make the script not execute in a development site. I must mention the head tag doesnt have or use any other get_site_url() in it. That function works fine anywhere in the site but this is my first time using it in the head tag. Is there any other way I could do this and make it work?? My code is the following:
<head>
<?php if (get_site_url() === "https://www.testwebsite.com") : ?>
<script src="https://global.localizecdn.com/localize.js"></script>
<script>
!function (a) {
if (!a.Localize) {
a.Localize = {};
for (var e = ["translate", "untranslate", "phrase", "initialize", "translatePage", "setLanguage", "getLanguage", "getSourceLanguage", "detectLanguage", "getAvailableLanguages", "untranslatePage", "bootstrap", "prefetch", "on", "off", "hideWidget", "showWidget"], t = 0; t < e.length; t++) a.Localize[e[t]] = function () {
}
}
}(window);
</script>
<script>
Localize.initialize({
key: '12c7ba123a6af',
rememberLanguage: true
});
</script>
<?php endif; ?>
<?php wp_head(); ?>
</head>