Action that fires during form entry processing, after initial field validation has passed.


array Sanitized entry field values/properties.
array Original $_POST global.
array Form settings/data.



More Information

The wpforms_process action fires towards the end of form entry processing. It runs after all initial form fields have been validated and sanitized.

This hook should be used when the action potentially needs to return an error and halt form processing (see Examples below for details).

Examples: verify if a user account exists or validate data for a payment gateway.

Please remember that the form processing can still be halted/prevented after this hooks fires, by other code using the same hook.

See the note below about another similar hook that fires after all validation is passed.

Important note: If you are doing processing and do not need validation or need the entry ID, see wpforms_process_complete.


In the example code, you’ll see we’re first checking the form ID to make sure it matches the form that’s being targeted. Then we’re checking a specific field (by the field ID) to see if it’s empty.

Just remember to change the form ID from 5 to match your form ID and change the '4' to match your field ID.

 * Action that fires during form entry processing after initial field validation.
 * @link
 * @param  array  $fields    Sanitized entry field. values/properties.
 * @param  array  $entry     Original $_POST global.
 * @param  array  $form_data Form data and settings.
function wpf_dev_process( $fields, $entry, $form_data ) {
    // Optional, you can limit to specific forms. Below, we restrict output to
    // form #5.
    if ( absint( $form_data[ 'id' ] ) !== 5 ) {
        return $fields;
    // check the field ID 4 to see if it's empty and if it is, run the error    
    if(empty( $fields[4][ 'value' ]) ) 
            // Add to global errors. This will stop form entry from being saved to the database.
            // Uncomment the line below if you need to display the error above the form.
            // wpforms()->process->errors[ $form_data[ 'id' ] ][ 'header' ] = esc_html__( 'Some error occurred.', 'plugin-domain' );    
            // Check the field ID 4 and show error message at the top of form and under the specific field
               wpforms()->process->errors[ $form_data[ 'id' ] ] [ '4' ] = esc_html__( 'Some error occurred.', 'plugin-domain' );
            // Add additional logic (what to do if error is not displayed)
add_action( 'wpforms_process', 'wpf_dev_process', 10, 3 );

Snippet References: