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() {
 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.


 Posted by at 11:39 am  Tagged with:
© 2011 Indimon Internet Services

Site last updated April 23, 2022 @ 10:45 am

Return to Top ▲Return to Top ▲