cialis online pharmacy generic xenical cheap cialis online cialis generic viagra online in canada buy cheap levitra online cialis without a perscription order viagra uk no prescription flagyl cheap generic levitra buying viagra in the uk cheap viagra approved cialis deltasone online buy viagra online without prescription non prescription cialis buy orlistat uk buy cialis in india prednisone 60 mg female viagra online buy viagra without prescription celebrex prescriptions buy cialis canada best prices viagra alternative to prednisone cheapest generic levitra levitra 5mg cheap viagra cialis on line buy xenical without prescription online accutane canadian health care prednisone no prescreption viagra online generic female viagra europe buy cialis low price cheap india viagra

How to Show User IP Addresses in WordPress

If you wish for your commenters to see their IP’s on your WordPress blog, this easy tutorial from Syed Balkhi and his team at WPBeginner will show you how to tweak your site’s code so it every time a user visits your site, they will be able to view their own IP address.

Simply paste the following snippet in your theme’s functions.php file or in a site-specific plugin.

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

Then add the following code in your post, page, or sidebar widget. Just make sure that shortcode for sidebar widgets is enabled.

[show_ip]

That’s it!

If you have any further questions about the process, you can direct them to Syed right here.

Related Posts

How to Style Nav Links Using Floats With HTML5 and CSS3

WordPress Template of the Week: Starter

5 Common WordPress Mistakes and How To Correct Them

WordPress Template of The Week: Pinzolo

Leave a Reply