WordPress Location-based Content

Add or replace any content on your site based on the visitor’s physical location: continent, country, state, city, or timezone.

How does the WordPress location-based content work

If-So makes it easy to display location-based content by letting you add or replace any element on your pages according to the visitor’s location. You can dynamically change text, titles, menu items, images, videos, buttons, or any other on-page content.

The location-based content works seamlessly with every WordPress page builder.

How do we detect the user’s location?

Location detection is handled through a premium, highly accurate IP-to-location database. When higher precision is needed, the browser’s HTML5 Geolocation API can be used instead or in adittion, allowing address-level accuracy when the visitor grants permission.

No coding or technical setup is required. Simply install the plugin, select the target locations, and define the content to display.

Use cases

Create promotions in specific countries

location-based WordPress pop-ups

Highlight different products in chosen locations

location-based WooCommerce products

Direct visitors to the closest branch

Direct users to the nearest branch

Show location-based messages to visitors from certain locations

Location-based content

Why If-So for location-based content?

If-So gives you a fast, accurate, and reliable way to deliver location-based content in WordPress without technical overhead. Here’s why it’s the ideal solution:

  • No coding or technical skills required
  • Works with all caching plugins
  • Powered by a highly accurate premium IP database
  • HTML5 Geolocation API (in addition to IP-to-location)
  • Location stored in cache per session, avoiding repeated checks and improving performance
  • Works alongside other geolocation features: Dynamic Keyword Insertion, Manual Location Override, Geo Redirects, geo pop-ups, and more

Step-by-step: How to set up location-based content?

The setup involves two steps: (1) creating a trigger with a geolocation condition, and (2) adding a redirect shortcode that sends matching visitors to the target URL.

  1. Download and activate the If-So Dynamic Content plugin.
  2. On your WordPress dashboard, go to If-So → Add New Trigger. Screenshot
  3. In version A, select the geolocation condition and choose the locations you want to target. Screenshot
  4. In the version A content field, enter the content that will be displayed when the visitor’s location matches your targeting.
  5. In the default content field, enter the content to display when the visitor’s location does not match any of your targeted locations. Leave this field empty if you prefer not to show anything in these cases.
  6. Click Publish and paste the shortcode generated by If-So anywhere on your website where you want the content to appear. Screenshot
  1. Download and activate the If-So Dynamic Content WordPress plugin and the Conditional Elementor elements integration.
  2. In the Elementor editor, select the element you want to use as location-based content.
  3. In the element settings panel, go to the If-So tab.
  4. Choose the Geolocation condition, and select the location type (country, state, city, etc.), then pick the specific locations you want to target.
  5. Click Update to save the page.
  6. Test your location-based content using a VPN to simulate different locations.
  1. Download and activate the If-So Dynamic Content WordPress plugin.
  2. In the Gutenberg editor, select the block you want to use as location-based content.
  3. In the block settings sidebar, open the If-So Conditions panel.
  4. Choose the Geolocation condition and select the location type (country, state, city, etc.), then choose the specific locations you want to target.
  5. Update or publish the page to save your changes.
  6. Test your location-based content using a VPN to simulate different locations.

Monthly Session Limit

Geolocation usage is limited by the number of monthly sessions (it’s the only If-So condition that is limited). The beginning of a session is defined as when a visitor first visits a page with a geolocation trigger. The end of a session is when either a visitor closes the browser, or there have been more than 25 minutes of inactivity (it may vary slightly between browsers).

Click here for the geolocation pricing options.

Troubleshooting the Geolocation Condition

If you set up a geolocation trigger and it seems to not be working properly, there are a few common reasons to consider. Click here for the geolocation troubleshooting guide.

FAQ

  • Is the Geolocation service 100% accurate?

    We strive for maximum accuracy by utilizing a premium, highly accurate IP-to-location API.

    However, it’s important to note that no geolocation service can guarantee 100% accuracy. Several factors influence the accuracy of the location data, with the ISP of the IP address being a key factor. Accuracy is generally higher for fixed lines than it is for cellular networks.

    If you come across any inaccuracies, please report them to us, and we will ensure that the database is updated accordingly.

    Gain a deeper understanding of IP-based geolocation services and their operational principles

Screenshots

add new trigger
Create a trigger

Select location/s
trigger shortcode
Paste the trigger’s shortcode
4 3

5 3
6 2
7 1

8
Condition geo

Was this Helpful ?

    We're sorry couldn’t be more helpful ☹️

      Black Friday

      Sale!
      Up to 40%