How to Create an Anonymous Survey Form for Logged In Users


Would you like to create an anonymous survey form for your logged in users? By default, WPForms will capture the user ID and the user IP address for all entries.

The default entry screen will capture the user ID if the user is logged in but will also capture the user IP address

If you want to provide a truly anonymous form, this information must not be saved. Using a small PHP filter, you can easily disable storing these details and we’ll walk you through each step to create this form.

Creating your form

First, we’ll need to create a new survey form. If you need any help creating a survey form, please review this documentation.

Start by creating your survey form. To keep it truly anonymous, just omit the Name or Email form fields.

Remember to omit the Name and Email form fields form your form in order for it to remain 100% anonymous

Adding PHP to keep the form anonymous for logged in users

Now it’s time to add the code snippet that will remove the user ID and the IP address from the entry. If you need help on how to add code snippets to your site, please review this tutorial.

 * Remove user ID and IP address from form entry.
 * @link
function wpf_dev_entry_save_args( $args, $form_data ) {
    // Only run on my form with ID = 143, remember to change this to match your form ID
    if( $form_data[ 'id' ] != 143 ) {
        return $args;
    $args[ 'user_id' ] = '';
    $args[ 'ip_address' ] = '';
    return $args;
add_filter( 'wpforms_entry_save_args', 'wpf_dev_entry_save_args', 10, 2 );

The code will only run on the form ID 143, then it will reset the user_id and ip_address to empty as it runs through before saving the entry.

Now you have a fully anonymous form for logged in users

Please remember to update the 143 in the snippet to match your own form ID. If you need assistance in where to find your form ID, please check out this tutorial.

Would you like to add some styling to your Likert Scale? Take a look at our article on How to Customize the Likert Scale Field Table.

Filter Reference: wpforms_entry_save_args