Saturday , February 18 2017
Home > Wordpress > How To Show Visitors IP Address In WordPress Without Any Plugin

How To Show Visitors IP Address In WordPress Without Any Plugin

Today I Tell You How To Make Your Blog As a IP Detection Blog/Website. In This Way Your All Visitors Will See Their IP Address In Your Blog.

Please Copy The Below Code And Paste In Your Theme function.php File.

// Display User IP in WordPress

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');

Next Is Please Put The Below Shortcode In Your Post, Page OR Sidebar Widget Where You Want To Show Your Visitors IP Address.

[show_ip]

If You Are Use The Shortcode In Sidebar Widget And You Are Not See Any IP Address. Then Please Make Sure That You Are Enable Shortcode For Your Sidebar Widget.

Must Read: How To Create Password Protected Post In WordPress

Please Enable Your Sidebar Widget For Shortcodes By Paste The Below Code In Your Theme function.php

add_filter('widget_text', 'do_shortcode');

Check Also

How To Write a Full SEO Optimized Post In WordPress

As You Know WordPress Is a Best Platform For Bloggers and Thousands Of  Bloggers Use …

One comment

  1. It’s very sіmple to find out any topic on web as compared to books, aas
    I found tɦis post at this web page.