Back to Community

How to Add an Incremental ID to Your WPForms Submissions

20 threads Sep 7, 2025 PluginWpforms

Content

Many WordPress site owners need to assign a unique, sequential number to each form submission, such as for grant applications, order numbers, or support tickets. A common challenge is finding a way to generate this ID automatically within the free version of WPForms, which doesn't natively store entries.

Why This Happens

The free version of WPForms, WPForms Lite, is designed as a form builder and submission collector. Its core functionality does not include a built-in entry management system or the ability to generate and store unique incremental IDs for each submission. This is a feature typically associated with the paid versions that include entry storage.

Solution: Using a Custom Code Snippet

Fortunately, you can implement this functionality yourself using a custom code snippet. The WPForms team provides official developer documentation for this exact purpose. This method uses a hidden field and a WordPress hook to assign a sequential number to each new form submission.

Step-by-Step Implementation

  1. Add a Hidden Field to Your Form: In your WPForms form builder, add a 'Hidden' field. This field will store the unique ID.
  2. Install a Code Snippets Plugin: For beginners, the safest way to add custom code is by using the 'Code Snippets' plugin. Install and activate it from your WordPress admin dashboard under Plugins > Add New.
  3. Add the New Snippet: In the Snippets menu, create a new snippet and paste the following code. Remember to replace 123 with your actual form ID and 4 with the ID of your hidden field.
/**
 * Add an incremental ID to WPForms form submissions.
 */
add_action( 'wpforms_process', function( $fields, $entry, $form_data ) {
    // Only run for a specific form ID; replace 123 with your form's ID.
    if ( $form_data['id'] != 123 ) {
        return;
    }

    // Get the last used ID number from the WordPress options table.
    $last_id = get_option( 'wpforms_entry_id', 0 );
    // Increment the ID by 1.
    $new_id = $last_id + 1;

    // Update the option table with the new last used ID.
    update_option( 'wpforms_entry_id', $new_id );

    // Update the value of the hidden field; replace 4 with your field ID.
    $fields[4]['value'] = $new_id;

    // Return the modified fields array.
    return $fields;
}, 10, 3 );
  1. Activate the Snippet: Save and activate the snippet. The code will now run whenever your specified form is submitted.

Important Considerations

  • Testing: Always test this functionality on a staging site before implementing it on your live website.
  • Backups: The generated ID is stored in your WordPress options table. It is independent of form entry storage, which is why it works in WPForms Lite.
  • Custom Development: For more complex requirements, such as needing the ID to be reset annually or to include a prefix (e.g., APP-1001), you may need to hire a developer for further customization. The WPForms team often recommends services like Codeable or Seahawk for such custom work.

This approach provides a reliable method for generating unique application or order numbers directly within your form submissions, extending the functionality of WPForms Lite to meet your specific needs.

Related Support Threads Support