Description

Fires on form submit to load the URL needed for the redirect.

Parameters

$url
(string) URL for the redirect.
$form_data
(array) Processed form settings/data, prepared to be used later.
$fields
(array) Sanitized field data.
$entry_id
(int) Entry id.

Source

wpforms/includes/class-process.php

More Information

The wpforms_process_redirect_url filter that will be used to for the redirect once the form submits.

Examples

/**
 * Redirect URL.
 *
 * @link   https://wpforms.com/developers/wpforms_process_redirect_url/
 *
 * @param  string $url   URL for redirect.
 *
 * return  string
 */
   
function wpf_dev_process_redirect_url( $url, $form_data, $fields, $entry_id ) {

    // Only run on my form with ID = 47
    if ( absint( $form_data['id'] ) === 47) {
             $url = 'https://mysite.com/';  
        } 
         
    return $url;
     
}
add_filter( 'wpforms_process_redirect_url', 'wpf_dev_process_redirect_url' );


Snippet Reference: How to Preserve the Query Strings in the URL on Form Submit