How to Set Content Visibility Based on Geolocation in Elementor

Table of contents
To show or hide Elementor content by the visitor’s location, install Visibility Logic for Elementor and Visibility Logic Pro, save a free MaxMind account ID and license key under Settings > Visibility Logic, then select the element in Elementor, open the Visibility tab, switch on Enable Visibility Logic and enable the Geo Location condition. Pick Country or City, choose the places, set the action to Show or Hide, and update the page.
Geolocation is a Pro condition. The free plugin does not look up locations. Below are the steps, what the plugin does behind the scenes, and the two things that make location rules look broken: page caching and testing from the wrong place.
What do you need?
- Elementor. The free version is enough.
- Visibility Logic for Elementor (free) and Visibility Logic Pro, both active.
- A free MaxMind GeoLite account with an account ID and a license key.
Step 1: Create a MaxMind account and license key
Visibility Logic Pro asks MaxMind’s GeoLite web service which country and city an IP address belongs to. MaxMind gives the key for free, but you need an account.
- Sign up for a GeoLite account on MaxMind’s website and set your password from the email they send.
- In your MaxMind account, open the license keys page and generate a new key. Copy it right away: MaxMind shows it only once.
- Note your account ID, which MaxMind shows in the account.
The full walkthrough is in Create a MaxMind account and license key.
Step 2: Save the key in WordPress
- Go to Settings > Visibility Logic and open the Settings tab.
- Under MaxMind Api, fill in Account ID and License key.
- Click Save.
Until both values are saved, the Geo Location section in Elementor shows only a notice instead of its settings:
Step 3: Turn on Visibility Logic for the element
- Edit the page, post or template with Elementor.
- Select the widget, section or container you want to control.
- Open the Visibility tab in the panel. Older versions called it Stax Visibility.
- In the General section, switch Enable Visibility Logic to Yes.
Then set the two general options:
- Show/Hide action: what happens when the conditions match. The default is Hide. For “only visitors from Germany see this”, switch it to Show.
- Conditions Type: with more than one condition enabled, act when All match or when At least one matches.
Step 4: Enable Geo Location and pick the places
- Open the Geo Location section and switch Enable to Yes.
- Set Location Type to Country (the default) or City.
- Choose one or more entries in Countries or Cities.
- Click Update or Publish.
The condition matches when the visitor’s country, or city, is one of the ones you picked. With the action on Show, everyone else does not get the element. With Hide, it is the other way round. The settings are described in Geo Location.
Step 5: Test it from the right place
The editor always shows every element, so check the live page. Two details matter here.
Test on the live site. On a local site WordPress sees you as 127.0.0.1, which has no location. Visibility Logic then looks up a United States address instead, so a local test tells you little about real visitors. Use a VPN, or ask someone in the target country to open the page.
A location is remembered for 24 hours. The plugin looks up each IP address once and keeps the result for a day. That saves lookups on your MaxMind account, which has a daily limit on free accounts. It also means that a visitor who switches a VPN on can see the old result until the next day.
If you are logged in as an administrator and MaxMind cannot be reached or does not know an address, the page shows a short line starting with “Admin notice:”. Visitors never see it. The troubleshooting page explains each notice.
Mind the page cache
Visibility Logic decides on the server, when the page is built. If a caching plugin, your host or a CDN stores one copy of the page, every visitor gets the version built for the first one, wherever they are.
Exclude pages with location rules from the page cache. The same applies to any rule that depends on the visitor rather than on the page. See Rules look wrong for some visitors.
If your site runs behind Cloudflare, the plugin reads Cloudflare’s visitor IP header, so the lookup uses the real visitor address. Behind another proxy or load balancer, it may see the proxy’s address, and everyone gets the same country. Ask your host to pass the real visitor IP to WordPress.
Ideas for location rules
| Goal | Action | Location |
|---|---|---|
| A shipping notice only for the countries you ship to | Show | Country: the shipping countries |
| Hide an offer that is not available in one country | Hide | Country: that country |
| A local event banner | Show | City: the event city |
| A price note in the visitor’s currency | Show, one section per region | Country: the countries of each region |
For language rather than location, Pro also has a Language condition that reads the current language from WPML, Polylang or TranslatePress. On a multilingual site that is usually the better choice, because it follows what the visitor picked, not where they are.
What happens to hidden content?
A hidden element is left out of the page HTML. Visitors who do not match never receive it. If a script on the page needs the element to exist, turn on Keep HTML/Hide by CSS in the General section: the element is then printed and hidden with CSS, and anyone can read it in the page source.
With Pro you can also show something in place of the hidden element. The Fallback section replaces it with a text or an Elementor template, for example “This offer is not available in your country”. See Fallback content.
Free or Pro?
Geo Location is part of Visibility Logic Pro. So are IP and referrer rules, language, URL parameters, WooCommerce and Easy Digital Downloads customers, and fallback content. The free plugin covers User Role, User Meta, Date Time, Browser Type, Device Type and ACF Field, which is enough for many sites.
Pro costs $29 per year for 1 site, $39 for 3 sites and $79 for 100 sites, with a 30-day money-back guarantee. Compare the two in the Free vs Pro table.
The short version
Get a free MaxMind account ID and license key, save them under Settings > Visibility Logic, then enable Geo Location on the element in the Visibility tab, pick countries or cities and set the action. Test on the live site, not locally, and keep pages with location rules out of the page cache. Get Visibility Logic Pro next to the free plugin to start.