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 so it goes to another page source? This tutorial will show you how to use PHP to customize the form action and redirect the page to a specific URL.

By default, you can change the form’s action inside the form builder by setting the Confirmation Type on the Confirmations tab to a Redirect without the use of a snippet. To learn more about this, please visit this documentation.

Creating your form

First, you’ll need to create your form and add your fields.

If you need any assistance with this, please check out this documentation.

It’s important to note that if you are going to use this snippet, the settings you have set on the Confirmations tab will not be applied.

using this snippet to customize the form action will ignore any of the settings you have on the Confirmations tab

Disabling AJAX on your form

Before we move to the next step, navigate to Settings » General » Advanced and make sure the Enable AJAX form submission setting is turned off for your form.

Customizing the form action

In order to redirect the page to a specific URL using the form action, you’ll need to copy this snippet to your site.

If you need help in adding snippets, please review this tutorial.

 * Return a specific URL on the form submission.
 * @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 );

This snippet will only run on the form ID 25. You’ll need to update this ID to match the form ID of your form. If you need help in finding your form ID, you can review this tutorial.

Once you’ve defined the form ID, you’ll just need to update the URL from to match the URL you want to redirect to.

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

And that’s all you need to customize the form action for a redirect on submission using PHP. 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.

Reference Filter

Filter Reference: wpforms_frontend_form_action