### [Storing the Non-Cached IP Address Into a Hidden Field](https://wpforms.com/developers/how-to-store-the-non-cached-ip-address-into-a-hidden-field/)

**Published:** October 22, 2021
**Author:** David Ozokoye

**Excerpt:** This tutorial will walk you through how to set up a hidden field and using a small code snippet capture the non-cached IP address of the user completing the form.

**Content:**

Would you like to store the non-cached IP address in a Hidden Field with WPForms? The default `{user_ip}` Smart Tag in WPForms pulls the IP address of the user who is completing your form. However, this IP address is captured at the time the user loads the page and could very well be a cached version.

In this tutorial, we’ll show you how to capture the uncached IP addresses of users filling out your form.

---

## Creating Your Form

First, you’ll need to [create a new form](https://wpforms.com/docs/creating-first-form/) or edit an existing one to access the form builder. Once you’ve added all the necessary fields, add the **Hidden Field** to your form and note its ID.

![adding a hidden field to capture the non-cached ip address](https://wpforms.com/wp-content/uploads/2021/10/wpforms-user-ip-hidden-field.jpg)## Adding the Snippet to Capture the Uncached IP Address

**Note:** When using this snippet, you won’t need to use the `{user_ip}` Smart Tag. This snippet will automatically get the user’s IP for you and place it in the Hidden Field while ensuring that the number captured will not be the cached version of the IP address.

Now, it’s time to add the snippet to your site. To proceed, copy and paste the code snippet below to your site. If you need any help adding snippets to your site, [please see this tutorial](https://wpforms.com/developers/how-to-add-custom-php-or-javascript-for-wpforms/ "How to Add Custom PHP or JavaScript for WPForms").

The snippet above will only run on the form ID **727.** If the field ID of **10** is indeed a **Hidden Field**, it will update this field after the form is submitted with the current user’s [IP address](https://www.wpbeginner.com/glossary/ip-address/).

**Note:** Make sure to replace the form ID and field ID with your actual IDs. If you need help finding your form and field IDs, [please check out this tutorial](https://wpforms.com/developers/how-to-locate-form-id-and-field-id/ "How to Locate Form ID and Field ID").

![without using a Smart Tag, you can easily capture the IP address after the form is submitted to make sure the address that is recorded is a non-cached address](https://wpforms.com/wp-content/uploads/2021/10/wpforms-non-cached-ip-address.jpg)That’s it! You’ve now learned how to capture the uncached IP address of users filling out your WordPress form.

Are you looking to add CSS animation to your form’s confirmation message? Check out our tutorial to learn [how to add falling autumn leaves to your confirmation message.](https://wpforms.com/developers/how-to-add-falling-autumn-leaves-to-your-confirmation-message/ "How to Add Falling Autumn Leaves to Your Confirmation Message.")

## Related

Filter Reference: [wpforms\_process\_filter](https://wpforms.com/developers/wpforms_process_filter/ "Using the wpforms_process_filter filter")

**Categories:** Tutorials

**Tags:** PHP

---

