How to get IP addresses from WordPress comments & contact forms

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.


  1. why my wordpress comment only show
    can you tell me where is the problem?

    • Hi, Lucy. If your WordPress site is showing the comment authors as having a localhost IP address (, then this means that their client IP address is not being forwarded to your site properly. This can be due to a plugin or software that either you installed on your site or your web hosting provider has put on your site's web server. A web server PHP setting or configuration could also cause this. I suggest you contact your site's web hosting provider to assist you in isolating why your site is unable to detect the correct IP address of commment authors.

  2. Hi!

    Thanks for the instruction, but it's not working for me. I cut and pasted the short code into the message body section of the mail tab, and NOT the form itself as you warned, and it's still not working. Any ideas?


    • Hi, Chuck! Thanks for following our tutorial and sorry to get back to you only now. If the Contact Form 7 Special Mail Tag to get the form submitter's IP address isn't working, I suggest contacting Contact Form 7 Support as they would have a better idea about the possible reasons for this and how to address them.

  3. Will ip address tell someone's street address though? It was my understanding that up address will only tell the location of the isp and not the users street address. Is this true?

  4. I just added the remote ip code to the form and it's not working. I see the regular form and proper fields and the ip remote code. If it was working properly, I don't think I'd see the actual code in the form.

    • Hi Richard, the problem is that you have added 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. I have added a warning to the above article to make this clearer for people.

  5. I’m currently using contact form 7 and will use your suggestion. One question I do have is if you are using a CRM to send submissions to instead of email, where does the IP address go? Is there a hidden field in contact form 7 that I can use and when I do the mapping to the CRM create a matching field in the CRM for the IP address?

    • Hi Gerald, this would depend on the integration you're using to save Contact Form 7 submissions to your CRM. You would need to ask whoever provides this integration.

      • Hi Katie, thanks for your response. The integration I'm using for the CRM is pretty easy and simple. Basically whatever fields I have on my CF7 I just map them to where I want them to go in the CRM. The problem is that like you mentioned before, with Contact Form 7, it will only include IP addresses in the email notification if you include the remote IP tag you mentioned above. I tried to use the hidden field plugin for CF7 and my CRM mapping plugin regognizes the hidden field but within that hidden field tag I use the ip address tag above and nothing shows in the CRM field. I looked up a solution for this but so far have not found anything. What I did find were a couple of other people trying to do the same thing with no luck yet.

        • Hi, I recommend that you contact CF7 support about this and hopefully they will be able to help.

  6. Is it also possible not to receive the IP-adress of the person who fills in the contactform?
    Because of the new privacylaws in Europe I need to collect a minimal amount of personal information. The less, the better.

    • With Contact Form 7, it will only include IP addresses in the email notification if you include the remote IP tag mentioned above. Contact Form 7 doesn't store form submissions by default, so it won't be storing the IP address anywhere in the WordPress database (unless you use Contact Form DB, which is a separate plugin).

      Gravity Forms does store everything in the WordPress database and you would need to contact their Support to ask if there's a way to reduce the amount of information stored, including IP address.

  7. Ello Kate
    So basically. I have a website for my online game community. Occasionally I get innaprorpiate contact forms from the players who don’t like to play the game in a nice way. I don’t have enough to put $90 a year for a single plugin for a site that’s used for showcasing art and ingame rules for the community?

    Are there any other ways I could get their IPS so I can ban them from the site, and ban them ingame as well? It would really help me out.

    • Hi Israh, you can just use the free Contact Form 7 plugin mentioned in the article, instead of Gravity Forms.

      • When I tried installing it, I got "upgrade to the business plan to instal plugins."

        • Hi Israh, that sounds like a limitation on your hosting account. Maybe you need to upgrade your hosting plan to be able to install new plugins.

  8. Thanks for the helpful information

  9. Thanks for the helpful information

  10. Is there a way to display the IP's location - maybe under the IP address itself - in the "Comments" area of the WP Dashboard? I'm seeing a lot of activity against the same IP address and I want to see what is going on with that.
    Also, when I click on the IP address, the subsequent page filters all comments by that IP address. Is that normal behavior?

    • Hi Stephen, that's probably just how the plugin's IP address feature works. You could send them a support request to find out if there are any other options.

  11. Hi Katie, When I add the [_remote_ip] tag to my contact form less than 25% or so get delivered to my email. If I remove it everything works fine. Any ideas?

    • Hi Matthew. That's strange, I guess the remote IP tag is being flagged by spam detectors for some reason. It's worth contacting Contact Form 7 support about this.

Comments on this post are closed