WordPress is a one of the mostly used CMS in the world, a CMS is a content management system in short its a framework that permits anybody to make a site without any basic knowledge to programming which makes it an very hand tool for millions around the world.
Plugins are add-ons in WordPress, they increase the usefulness and features of the website without any programming from your side as a developer. The real disadvantage of plugins is that they have a tend to increase the load on the web server that might cause it to crash in many instances.
This post will show step by step guide on the how to show visitors IP address without the using of any plugin, one of the major advantage of showing the visitor their IP is for spammers, its similar to letting them know I’ve got my eye on you which may make them quit spamming on your website. Without further chatter let’s jump to the tutorial.
Step 1: Go to your website and log into your WordPress dashboard (www.yourdomain.com/wp-admin) and enter your credentials, then enter the dash board.
Step 2: In your dashboard enter your Appearance menu.
Step 3: In the Appearance menu, go to the “Editor” tab.
Step 4: Open the function.php file at the right hand side of the screen and copy and paste the following code in it.
function get_the_user_ip() if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) //check ip from share internet $ip = $_SERVER['HTTP_CLIENT_IP']; elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) //to check ip is pass from proxy $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; else $ip = $_SERVER['REMOTE_ADDR']; return apply_filters( 'wpb_get_ip', $ip ); add_shortcode('show_ip', 'get_the_user_ip');Step 5: Create a new text widget and copy and paste the following line of code in the body of the widget:
[show_ip]
Now, any new visitor will see their IP on their monitor screen, so spammer will behave as they’ll think that you’re keeping an eye on them.
Display User IP in Wordpress Without Plugin