### [How to Customize the Form Action](https://wpforms.com/developers/how-to-customize-the-form-action/)

**Published:** March 31, 2020
**Author:** Editorial Team

**Excerpt:** This tutorial will walk you through how to customize the form action by redirecting the form to another URL on submission. 

**Content:**

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](https://wpforms.com/how-to-redirect-users-after-a-wordpress-form-submit/ "How to Redirect Users After a WordPress Form Submission").

## 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](https://wpforms.com/docs/creating-first-form/ "How to Create Your First Form").

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](https://wpforms.com/wp-content/uploads/2020/03/wpforms-redirect-after-submit.jpg)

## 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.

![](https://wpforms.com/wp-content/uploads/2020/03/wpforms-disable-ajax.jpg)

## 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](https://wpforms.com/developers/how-to-add-custom-php-or-javascript-for-wpforms/ "How to Add Custom PHP or JavaScript for WPForms").

```

/*
 * Return a specific URL on the form submission.
 *
 * @link https://wpforms.com/developers/how-to-customize-the-form-action/
*/

function wpf_custom_form_action( $action, $form_data ) {
    
    if ( $form_data[ 'id' ] == '25' ) {

        return 'https://www.somesite.com';

    }

    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](https://wpforms.com/developers/how-to-locate-form-id-and-field-id/ "How to Locate Form ID and Field ID").

Once you’ve defined the form ID, you’ll just need to update the URL from **https://www.somesite.com** 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](https://wpforms.com/developers/how-to-add-a-select-all-option-to-a-checkbox-form-field/ "How to Add a Select All Option to a Checkbox Form Field").

## Reference Filter

Filter Reference: [wpforms\_frontend\_form\_action](https://wpforms.com/developers/wpforms_frontend_form_action/ "Using the wpforms_frontend_form_action filter")

**Categories:** Tutorials, Extending

**Tags:** PHP

---

