Struggling to get the IP address and location of your website visitors on WordPress? I know you must have gone through a lot of guides that only tell you how to fetch the IP address, but leave out how to find the location and exact Geo Coordinates of the user.
Your search finally ends here. Understanding the needs of webmasters like yourself, I’ve developed a WordPress plugin called “User IP and Location.” It’s a super useful tool for capturing not just the IP but also the location details, Geo Coordinates, and much more whenever someone visits your site.
If you’re unsure about how to get hold of the visitor’s IP and location details, just stick with me. Read this guide thoroughly to learn all about it.
Find out where your website visitors are coming from. This plugin helps you to get the visitor's IP address and location after they visit your website.Get WordPress Plugin
How to Get User IP and Location in WordPress
Here are the steps through which you can get the user IP, location, and other details using the WordPress plugin named “User IP and Location” which is available for free on the WordPress repository.
To set up this plugin, you can either get the plugin files from the WordPress store or log in to your WordPress admin panel. After you log in, just go to “Plugins > Add New” and look for the “User IP and Location” plugin.
I can guide you through this if you need help, just know that it’s a straightforward process.
Once you spot the plugin, just hit the “Install Now” button and then give a quick click on the “Activate” button.
Once you enter the details using the shortcodes shown in the image above, it will display the user details along with other important information to your readers.
Code Snippets for Getting User IP
If you’re not comfortable using the “User IP and Location” plugin mentioned above, you can just use the PHP code provided to display users’ IP addresses on your website.
The code is easy to use – simply install a plugin called “Code Snippets” on your blog and then paste the code below.
If you put these codes into the “Code Snippets” plugin, then to show the IP address of people who visit your site, just use the shortcode [show_ip].
Generally speaking, I don’t suggest you go for this “Code Snippets” method, because it only lets you see the visitor’s IP address.
A Few More Plugins for Getting User IP Details
Apart from the “User IP and Location” plugin, here are a few alternatives to this plugin that you can try on your WordPress blog or website.
This plugin has not been tested with the top three major updates of WordPress; however, it continues to work smoothly, displaying the user’s IP address. It only shows the user’s IP address on the front end, so if you require additional details about the IP address, I do not recommend using this plugin.
However, if your main goal is to display the IP address on your blog, you can certainly give it a try. You can also use various other geo-IP location APIs to create your own user-tracking plugin/system.
This plugin functions similarly to “User IP and Location” but lacks several features available in the plugins mentioned above. Such features may include retrieving the user’s timezone, ISP, flag, etc.
Another aspect of this plugin that I found disappointing is that when I used it on my website hosted with Cloudflare, it displayed my hosting IP instead of the visitors’ IP addresses.
However, it is certainly one of the most installed plugins and works like a charm for your website—as long as you’re not using Cloudflare on your blog.
In this guide, I tried to explain how you can get the IP details of users in WordPress and show it on the frontend. If you’re not quite sure about PHP and other programming languages, I strongly recommend using the plugins to get the IP details of the user and to do conditional things using it.
If you feel any issues using the plugin or have any doubts, then you can reach us at [email protected], or you can also share your queries in the comment section below.