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
At last, the IP address looks like this.