Suffering to get the IP address and location of the user in WordPress website and not sure how to grab the location of user along with the IP address? I know when you search here and there for the proper guide, you’ll find the option to get only IP information – and none of them actually share the ways through which you can grab the location as well as coordinates details of the user.
But your search ends here, depending on the needs of webmasters like you, I’ve created a similar plugin named “User IP and Location” for WordPress. This plugin is really helpful for getting the user location, IP, Geo Coordinates, and a lot more details when a user tries to visit your website.
So if you’re not sure how to get the user IP and location, then read this guide completely to learn more 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 install this plugin, either you’ve to download the plugin files from the WordPress repository or login to the admin panel of your WordPress. Once you’re inside of your WordPress admin panel, visit “Plugins > Add New” and search for the “User IP and Location” plugin.
Once you find the plugin, click on the “Install Now” button and then click on the “Activate” button. It will install and activate the plugin for you.
When the plugin is installed on your WordPress website, it is ready to use in your WordPress posts, pages, widgets, and custom post types.
Here are the shortcodes for getting various information through this plugin;
- User IP: [userip_location type=ip]
- User City: [userip_location type=city]
- User Region: [userip_location type=region]
- User Country: [userip_location type=country]
- User Country Code: [userip_location type=countryCode]
- Latitude: [userip_location type=lat]
- Longitude: [userip_location type=lon]
- Timezone: [userip_location type=timezone]
- ISP: [userip_location type=isp]
- Flag: [userip_location type=’flag’ height=’auto’ width=’50px’]
Once you entered the details using the shortcodes shown in the image above, it will show the user details along with other important information to your reader.
Pro Tips: You can also use these shortcodes to do conditional things based on the user’s details on your website. But it may require a separate plugin or PHP code.
Code Snippets for Getting User IP
If you’re not comfortable with using the “User IP and Location” plugin which I shared above, you can simply use the PHP code which I shared above to display the IP address of users on your website.
The code is simple to use, you just have to install a plugin named “Code Snippets” on your blog and then paste the code which I shared below.
Once you add these codes in the “Code Snippets” plugin. You’ve to use the shortcode [show_ip] to display the IP address of users on your website.
I usually don’t recommend using this “Code Snippets” method, because it only shares the IP address of the user, and getting other details will get complicated for you.
A Few More Plugins for Getting User IP Details
Apart from the “User IP and Location” plugin, here are a few alternatives of this plugin that you can give a try on your WordPress blog or website.
1. Show IP Addresses
This plugin is not being tested with the top 3 major updates of WordPress but still, it works smoothly to show the IP address of the user. This plugin only shows the IP address of the user in the frontend, so if you need some additional details of the IP address, I don’t recommend using this plugin.
But you can surely give it a try, only if your main goal is to show the IP address on your blog. You can also use various other geo-IP location APIs to create your own user tracking plugin/system.
2. Show Visitor IP
This plugin works a lot similar to “User IP and Location” but it misses a few features which are available in the plugins I shared above. Some of these features can include getting the user’s timezone, ISP, flag, etc.
Another thing that I disliked in this plugin is when I tried using this plugin on my website hosted with Cloudflare, it shows my hosting IP instead of the IP address of users.
But surely, it is another most installed plugin which works like a charm for your website (only if you’re not using Cloudflare on your blog).
Recommended Posts in WordPress Category;
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 issue 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.