How to get IP addresses from WordPress comments & contact forms

Published on: Updated: January 11, 2019

How to collect ip addresses from WordPress comments

A client recently asked how to find out the IP address of everyone who leaves a comment or submits a contact form on their WordPress website.

There’s a simple answer to the question, but it’s not one that most people know. The solution doesn’t even involve installing any extra plugins (apart from the plugin you are already using for the contact form). I hope this post helps other people who have the same question about their website.

WordPress comments and IP addresses

If you want to find out the IP address of everyone who comments on your WordPress posts, don’t bother looking for a plugin to do this. It’s already built into WordPress.

Simply go to the ‘Comments’ section in the WordPress admin. The IP address appears in the left hand column (titled ‘Author’) immediately underneath the commenter’s name and email address.

You’ve probably seen it dozens of time but never noticed.

Contact Form 7 and IP addresses

Contact Form 7 is the most popular free WordPress contact form plugin. It’s actively used on over 1 million websites worldwide.

I remember Contact Form 7 being quite basic a few years ago. However since then, it has been actively developed. Many new features have been added, making it a highly sophisticated contact form plugin.

One of Contact Form 7’s lesser known features is the Remote IP tag. Add the following shortcode anywhere within the Message Body section in the Mail tab in your contact form settings:


Adding this shortcode will automatically insert the user’s IP address into the email notification that the administrator receives whenever a new form is submitted on the website.

Warning: You do NOT need to add the [_remote_ip] shortcode to the actual form. You only need to add it to the ‘Mail’ tab so that the IP address is added to the email that you receive when someone submits the form.

How to track IP addresses using Gravity Forms

Gravity Forms is the world leading premium WordPress contact form plugin. As you would expect from a paid-for plugin used on over 1 million websites, it already has this feature built in.

To insert the user’s IP address into the email notification to the administrator, add the following merge tag anywhere within the body for the email:


You can read more on Gravity Forms’ Merge Tags page.

Filed under: WordPress Plugins