How to Customize the Form Action


Do you need to customize the form action on WPForms? Perhaps you are integrating your WPForms with an external source and need to customize the action on submit? This tutorial will show you how to use PHP to customize the form action and redirect the page to a specific URL.


In order to redirect the page to a specific URL using the form action, copy this code snippet to your site. In our example below, the form ID 25 will redirect to a specific URL when the form submits.

 * Return a specific URL on form submit.
 * @link
function wpf_custom_form_action( $action, $form_data ) {
    if ( $form_data['id'] == '25' ) {
        return '';

    return $action;
add_filter( 'wpforms_frontend_form_action', 'wpf_custom_form_action', 10, 2 );

Remember to change the == '25' to match your form ID.

Please note, when placing a redirect URL, the form entry will not be saved in your WPForms Entries.

Would you like to provide a select all option on your Checkbox field? Take a look at our article on How to Add a Select All Option to a Checkbox Form Field.

Filter Reference: wpforms_frontend_form_action