Description

Filter used to alter the default form action on submission of the form.

Parameters

$action
(array) Action to be taken on form submit.
$form_data
(array) Processed form settings/data, prepared to be used later.

Source

wpforms/includes/class-frontend.php

More Information

The wpforms_frontend_form_action filter can be used to alter the default action of the form.

Example

/**
 * Alter default action of form submission.
 *
 * @link    https://wpforms.com/developers/wpforms_frontend_form_action/
 *
 * @param   array  $action     Returning action to be taken on form submit.
 * @param   array  $form_data  Form data.
 *
 * @return  array
 */

function wpf_custom_form_action( $action, $form_data ) {
    
if ( absint( $form_data['id'] ) !== 5 ) {
            return;
        } 
          
    // Run code.
 
}
add_filter( 'wpforms_frontend_form_action', 'wpf_custom_form_action', 10, 2 );

Snippet Reference: How to Customize the Form Action