• Hi i would like to show the age restriction by country, so certain countries will see the message only and others will simply bypass or will not be shown.

    Is this possible to do?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Phil

    (@philsbury)

    Hi @xdk1ng,

    It’s possible but depends how you are determining the country the user is in.

    If you’ll not show it on a language part of the site, i.e. /es/ for example, you can filter age_gate_restricted like this:

    
    add_filter('age_gate_restricted', function($restricted){
        $unrestrictedLocales = ['es', 'fr', 'dk'];
    
        // You will need to call the method to get the current language
        // from your translation plugin here
        // e.g. $lang = get_language()
        $lang = '';
    
        if (in_array($lang, $unrestrictedLocales)) {
            return false;
        }
    
        return $restricted;
    });
    

    If you need something more complex like Geo location, then that’s a little outside the scope for support here, but in theory the logic would be pretty similar, just getting the country from whatever GeoIP service you have available.

    Thanks
    Phil

Viewing 1 replies (of 1 total)
  • The topic ‘Show age restriction by coountry’ is closed to new replies.