How to Show Visitors’ IP Addresses on WordPress Sites?

IP address is an Internet address that is used uniquely to identify the logical address of the computer on the Internet. Each networked computer relies on IP address to identify itself. This guide introduces two methods to help readers show visitors’ IP address on WordPress sites with ease.

As IP address clearly showcases the visitors’ computer, it helps webmasters to track visitors’ regions, with which you can easily analyze their customs, preferences, and habits, and come out suitable content. As well, you can build up a professional IP detection site to make money. No matter what is your purpose, it is quite easy to show IP addresses on WordPress sites because of the great flexibility and customizability of WordPress. In the following, we guide you achieve it by using code and plugin.

Show IP Address with Code

It’s very simple to show visitors’ IP address by using code. You can just copy the below code and paste it into the theme’s functiona.php file.

In the next, you can just add the below shortcode in the somewhere you want to showcase the IP address.

Note that if you try to insert the shortcode in a sidebar widget but it’s not working, you should go check whether you have enabled the shortcode for sidebar widgets. If not, you need to add the following snippet in the function.php file.

Then, you still need to log into WordPress dashboard and go to Appearance -> widgets to create a new text widget, add the shortcode into it and then it will work properly.

Show IP Address with Plugin

WordPress comes with a powerful Plugin architecture that enables users to extend the functionality easily by installing a plugin. For example, you can install W3 Total Cache to speed up the site, or use a security plugin to secure WordPress site. Obviously, it’s the easiest way to show IP address with a suitable plugin.

User IP is a great WordPress plugin that is designed for displaying visitors’ IP addresses on posts, pages, or anywhere else you like with a simple shortcode [user-ip]. For example, you can insert the shortcode like the below

Joyce is a professional writer & SEOer who loves trying new things and sharing the experience through blogging. She loves clean design, playing with different WordPress themes, SEO, etc. Now she is very struggle with purchasing a bubbling apartment in downtown. You can help her by clicking our ADs or making a purchase via our links ;-)

WhatsWP is designed to help WordPress beginners start and manage a WordPress site easily by providing the tutorials and guides about WordPress coding stuff, blog writing, monetization, SEO, themes, plugins, web hosting, etc.

The site was founded in 2011 and renamed from WPMatter on May 5th 2015 by Joyce, Lucy and Eunge, who are professional WordPress geeks. Each of them has worked for WordPress matters for over 5 years. Now we're a small business in San Francisco with 20+ full-time staffs fully devoted into the online blogging business.

FTC Disclosure

We're paid by for the product listing, advertisement and referral. However, this does not affect our independent thought. We never accept the review & rating linked to payments at all. We always work hard and try our best to help people find reliable WordPress hosts and other products at an affordable rate, based on our real WordPress experience in the past 7 years.