Javascript 如何使用WP Geolocation js自动重定向

Javascript 如何使用WP Geolocation js自动重定向,javascript,wordpress,geolocation,geo,Javascript,Wordpress,Geolocation,Geo,朋友们好,当我使用wp geolocation pluggin短代码时,它准确地显示了我的位置 但我只需要这个 iam正在尝试根据以下位置自动重定向url <script type="text/javascript"> <!-- window.location = "http://[mmjs-city].gumpul.com/" //--> </script> 但它不会重定向 但是当我使用“[mmjs city]”短代码时,它正确地显示了我的城市

朋友们好,当我使用wp geolocation pluggin短代码时,它准确地显示了我的位置 但我只需要这个

iam正在尝试根据以下位置自动重定向url

    <script type="text/javascript">
<!--
window.location = "http://[mmjs-city].gumpul.com/"
//-->
</script>

但它不会重定向

但是当我使用“[mmjs city]”短代码时,它正确地显示了我的城市名称,请给我一个解决方案

试试:

<script type="text/javascript">

var url= "http://"+geoip_city()+".gumpul.com/";
window.location = url;

</script>

var url=“http://“+geoip_city()+”.gumpul.com/”;
window.location=url;