-1

I always have 500 error whenever I add this to my plugin folder

<?php
function chk()
{
    global $post;
    if(is_page() || is_single())
    {
        if(get_field("geobot") && get_field("geourl"))
        {
            $geoplugin = new geoPlugin();
            $geoplugin->locate();
            // create a variable for the country code
            $var_country_code = $geoplugin->countryCode;

            $CodeList = ['US', 'CA', 'AU']; 
            // redirect based on country code:
            if (in_array($var_country_code, $CodeList))
            {
              ob_clean();
              ob_start();
               header("Location: ".get_field("geourl"),true,301);

            }
        }
    }
}
?>
  • Please share more details of the plugin as well as the plugin file where you are adding it – Pratikb.Simform Oct 18 at 9:20
  • where you are adding code in plugin file ? have you used geoPlugin plugin or library ? try with comment some part of code to find out where is a actual issue. – Chetan Vaghela Oct 18 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.