Mar 172013
 

In some circumstances there are benefits to displaying visitor’s IP addresses inside certain WordPress pages and posts. If a potentially malicious visitor decides to visit your WordPress website, they will most likely see that their IP address has been identified and will consider their actions. There is a WordPress function snippet which will allow you to display user and visitor IP addresses using the shortcode [ user_ip].

Copy and paste the snippet below into your theme’s functions.php file

function display_user_ip() {
 $ip = $_SERVER['REMOTE_ADDR'];
 return $ip;
}
add_shortcode('user_ip', 'display_user_ip');

Use shortcode: [ user_ip] in pages and post or include the use of shortcodes in template files and widgets. To properly use the shortcode remove the leading space.

Source: http://botcrawl.com/how-to-display-user-and-visitor-ip-addresses-on-wordpress-using-shortcodes/

3,821 total views, 1 views today

 Posted by at 11:39 am  Tagged with:

 Leave a Reply

*

© 2011 Indimon Internet Services

Site last updated March 11, 2017 @ 9:57 am; This content last updated March 17, 2013 @ 11:39 am

Return to Top ▲Return to Top ▲