User Location and IP is a simple plugin which shows the real-time information about your user's IP address, location, and user's country fla …
“User Location and IP” plugin is one of the best free WordPress plugins that let you know all the information about your visitors in real-time, including their IP address, ISP details, location, operating system, browser, city, and many other details, all of which can be displayed via shortcodes on your website posts, pages, and widget.
In order to use this plugin, you just need to copy one of the appropriate shortcodes from the list below. You can paste it into the location where you want the details to appear. This can be in the sidebar, the header, the footer, or even in the middle of the content.
Here’s the list of various shortcodes provided by the “User Location and IP” plugin:
As for the Flag shortcode, the height, width, and vertical_align attributes are optional. The default values for height and weight are auto and 50px, respectively. For the vertical_align attribute, baseline is the default value. You can, however, change the vertical_align attribute value to bottom, middle, or top based on the location where you want the flag to appear. Depending on your preference, you can pass one or both of these values to alter the flag’s size.
If you are looking for a plugin that can display visitors’ real-time information anywhere on your blog, then User Location and IP can help you. The plugin is free and doesn’t require any registration.
How do I show the visitor’s IP address in WordPress?
Add the [useriploc type="ip"] shortcode, the Visitor Info block or the Elementor Visitor Info widget. It shows the user IP, meaning the visitor’s public IPv4 or IPv6 address. Add mask="yes" to show it as 203.0.113.xxx.
How do I show the visitor location?
Use the location shortcodes, for example [useriploc type="city"], [useriploc type="regionname"] and [useriploc type="country"], or the Visitor Info block. You can combine them in a sentence: “You are visiting from [useriploc type=”city”], [useriploc type=”country”]”.
How do I show or hide content by country?
Wrap the content in [useriploc_if country="US,CA"]...[/useriploc_if], use the Geo Content block, or open any Elementor element’s Advanced tab and use Geo Visibility. Add [else] inside the shortcode for an “everyone else” version.
How do I redirect visitors by country?
Go to Settings > User Location and IP > Redirects, switch on country redirects and add a rule: the countries, the page (or leave it empty for the whole site), the target URL and the redirect type.
Do country redirects affect SEO?
Search engine crawlers are never redirected, so they can index every page. Use 302 or 307 redirects while testing, because browsers remember 301 redirects.
How do I test what visitors from another country see?
Use a VPN set to that country, or the Test a lookup box on the settings page to see what the plugin returns for any IP address. Add ?useriploc_noredirect=1 to a URL to view it without country redirects.
Can I hide WooCommerce products by country?
Yes. Edit a product, open the Geo visibility tab and choose “Hide from these countries” or “Show only to these countries”. Hidden products disappear from the shop, search and product blocks, cannot be bought and show “not found” on their own page.
Is hiding content or products by country secure?
It is meant for showing the right content to the right visitors, not as access control. Visitors using a VPN appear to be in the VPN’s country, and in AJAX mode hidden content is still included in the page’s HTML. Don’t use location rules to protect confidential information.
Does it work with caching plugins like WP Rocket or LiteSpeed Cache?
Yes. In Server mode, pages that show visitor details are excluded from page caching automatically. In AJAX mode, pages stay cacheable and the details load right after the page. Country redirects, WooCommerce product rules and Elementor geo rules always run on the server, so those pages are always excluded from page caching.
Can I show the visitor’s country flag?
Yes. Use [useriploc type="flag"] for an image (change the size with width, for example width="24px") or [useriploc type="flagemoji"] for an emoji. If the country is unknown, no flag is shown.
Can I show the visitor’s local time, currency and timezone?
Yes. Use [useriploc type="localtime"], [useriploc type="localdate"], [useriploc type="currency"] and [useriploc type="timezone"]. Add format="H:i" to choose your own time format.
Can I detect the visitor’s browser and operating system?
Yes. [useriploc type="browser"] and [useriploc type="os"] detect them from the browser’s user agent, without any external service.
Is this a free WordPress geolocation plugin?
Yes. User Location and IP is completely free, with no premium version and no upsells. Every feature described on this page is included.
Do I need an API key?
No. The plugin uses free HTTPS geolocation services that need no API key or sign-up and allow use on commercial websites. If you need higher limits, you can enter a paid ipwhois.pro API key in the settings.
Is there a limit on lookups?
ipwho.is allows 1,000 free lookups a day per site and freeipapi.com allows 60 a minute. Because each visitor is looked up only once per cache period, IPv6 visitors on the same network share one lookup and crawlers are skipped, most sites stay well within these limits. If ipwho.is reaches its limit, the plugin switches to freeipapi.com automatically.
Will this plugin slow down my website?
No. Each visitor’s location is fetched once, cached and shared by every feature on the page. In Server mode no JavaScript is added for visitor details. If a geolocation service is slow, the plugin stops waiting after 3 seconds.
Does it work with Cloudflare or behind a proxy?
Yes. The plugin reads the real visitor IP from Cloudflare and from proxies on your own network. If your site is behind another CDN, such as Sucuri, Fastly, Bunny or CloudFront, set Proxy headers to “Always trust them” in the settings. The plugin shows a notice if it detects this situation.
How accurate is the location?
Country detection is very accurate. City and region are usually correct but can be off, because IP geolocation shows where the visitor’s internet provider routes traffic, not their exact address. Visitors using a VPN or proxy appear in the VPN’s location.
Why is the city or ISP empty for some visitors?
Geolocation databases don’t have a city or ISP for every IP address, especially mobile networks and newly assigned addresses. Use the default attribute to show fallback text, for example [useriploc type="city" default="your city"].
Does it support IPv6?
Yes. Both IPv4 and IPv6 visitors are detected, looked up and can be masked.
What happens if the geolocation service is down?
The plugin tries the backup service. If both are unavailable, location values are left empty (or show your default text) and the plugin tries again a few minutes later. The IP address, browser and operating system keep working.
What do search engines see?
Crawlers such as Googlebot are not looked up. They see empty location values, are never redirected and can see every WooCommerce product, so your pages and products stay indexable. Products with country rules can never be bought by a crawler, so faking a crawler’s user agent doesn’t get around them.
Where can I use the shortcodes?
Anywhere WordPress shortcodes work: the block editor (Shortcode block or inside any paragraph), the classic editor, widgets, WooCommerce product descriptions, and page builders such as Elementor, Divi and Beaver Builder. In theme files, use <?php echo esc_html( useriploc_get( 'country' ) ); ?>.
What does the visitor log store, and is it GDPR friendly?
The visitor log is off by default. When you switch it on, it stores each visit’s full IP address, approximate location, page, referrer, browser and operating system, and deletes entries after the number of days you choose. The plugin adds suggested text to your privacy policy and supports WordPress’s personal data export and erase tools. Mention the geolocation service and, if used, the visitor log in your privacy policy.
Does the plugin set cookies?
No. The plugin sets no cookies.
Why do the location shortcodes show nothing when I test locally?
On a local development site, your IP is a private address (such as 127.0.0.1 or 192.168.x.x) that has no location. Test on a live site or with the Test a lookup box in the settings.
Can I clear the location cache?
Yes. Click Clear location cache on the settings page. You can also choose how long locations are cached, from 1 to 168 hours.
Can I translate the plugin?
Yes. All text is translatable and translations can be contributed at translate.wordpress.org. Location names are shown in English, as provided by the geolocation service.
Can developers use the plugin in custom code?
Yes. Use useriploc_get( 'city' ) for one value, useriploc_get_data() for everything, useriploc_matches_conditions() for geo rules, or the REST endpoint /wp-json/useriploc/v1/visitor. Filters let you change the location data, cache time, lookup services, trusted proxies, redirect targets and log entries.