Country Block & Geo Restrictions – 3 options

Set up WordPress country blocking and IP-based restrictions at the page level or across the site.
Country Block feartured image

How does the Country Block option work

The Country Block option is an IP-based solution. No complicated setup is required – the plugin handles everything for you and works seamlessly on any WordPress website.

As If-So is a server-side WordPress block country plugin, restricted content is never loaded (unlike solutions that simply hide content using CSS).

Country Block can be applied at three levels:

  1. The entire site
  2. A specific page
  3. Pages, posts, or WooCommerce products in a specific category (Click here if you are interested in this option)

Use cases

Here are some common ways to use country blocking on your site:

  • Prevent users from countries where your service is not legally allowed.
  • Block content from countries with a high volume of malicious traffic.
  • Restrict access to products that cannot be sold or shipped to certain countries.
  • Block promotional pages in countries where the offer is not valid.
  • Block content to avoid processing leads from unsupported countries.

Step-by-step: How to set up country block using the If-So WordPress plugin

  1. Download and activate the If-So Dynamic Content WordPress plugin.
  2. On your WordPress dashboard, go to If-SoAdd New Trigger. Screenshot
  3. In Version A, select the Geolocation condition and choose the continent, country, state, city, or timezone you want to target. Screenshot
  4. Paste the shortcode below into Version A’s content field. Screenshot
[ifso_hide_site_content block_admins='yes' message='This page is not available in your country!']
  1. Leave the Default version empty if you do not want any action when the condition is not met.
  2. Click Publish and paste the trigger’s shortcode on your page. Screenshot

Site-level country blocking

To create a country block at the site level, add the shortcode to the site header using If-So (see how) or any other method.

!

These steps apply to page-level blocking. For site-level blocking, see the All page builders tab.

  1. Download and activate the If-So Dynamic Content WordPress plugin and the Conditional Elementor elements integration.
  2. On the page where you want to block users, drag a Shortcode Element to the top of the layout and paste the following shortcode:
[ifso_hide_site_content block_admins='yes' message='This page is not available in your country!']
  1. With the Shortcode widget selected, go to the If-So conditions tab and open the If-So Dynamic Content section.
  2. Choose the Geolocation condition and select the countries / states / cities you want to block. Screenshot
  3. Click Update to save the page.

!

These steps apply to page-level blocking. For site-level blocking, see the All page builders tab.

  1. Download and activate the If-So Dynamic Content WordPress plugin.
  2. On the page where you want to block users, add a Shortcode Gutenberg Block to the top of the layout and paste the following shortcode:
[ifso_hide_site_content block_admins='yes' message='This page is not available in your country!']
  1. With the Gutenberg shortcode block selected, go to the If-So conditions tab and open the If-So Dynamic Content section.
  2. Choose the Geolocation condition and select the countries / states / cities you want to block. Screenshot.
  3. Click Update to save the page.

FAQ

Can users bypass the country block?

Yes. Visitors using VPNs or proxy services may bypass country-based restrictions by masking their real location.

Is the blocked content hidden with CSS?

No. The Country Block works on the server side, so blocked content is never loaded or rendered.

Does this work with caching?

Yes. If-So works with all caching systems.

Can I block only part of a page instead of blocking the entire page?

Yes. You can make specific elements on a page location-based, so they load only for visitors from selected locations.

Screenshots

add a new trigger 1
Create a new trigger
Select location(s)
Add the country block shortcode
Add the country block shortcode
trigger shortcode 1
Apply the trigger’s shortcode to your page.
country block elementor
Country Block with Elementor
country block gutenberg
Country Block with Gutenberg

Didn’t find what you need?

Winter Sale!
Up to 40% Off