apply_filters ( 'grunion_contact_form_redirect_url', string $redirect, int $id, int $post_id )

Filter the URL where the reader is redirected after submitting a form.

Source file: modules/contact-form/grunion-contact-form.php

View in GitHub



(string) Post submission URL.


(int) Contact Form ID.


(int) Post ID.


Since: Jetpack 1.9.0

How to use this hook

See Using actions and filters to customize Jetpack.


This filter allows us to set different redirection URLs for each form on your site. Here is an example:

 * Jetpack Contact Form Custom Redirections.
 * @param  string $redirect Post submission URL.
 * @param  int    $id       Contact Form ID.
 * @param  int    $post_id  Post ID.
 * @return string $redirect Custom Post submission URL.
function jetpackcom_custom_form_redirect( $redirect, $id, $post_id ) {
     * Create a list of pages where you've inserted forms.
     * For each contact Form ID (found via the id attribute on the form),
     * set up a custom URL where the user will be redirected.
    $redirects = array(
        '1370' => home_url( 'page_on_your_site' ),
        '2239' => home_url( 'another_page' ),
        '1370' => home_url( 'page_on_your_site' ),
    // Let's loop though each custom redirect.
    foreach ( $redirects as $origin => $destination ) {
        if ( $id == $origin ) {
            return $destination;
    // Default Redirect for all the other forms.
    return $redirect;
add_filter( 'grunion_contact_form_redirect_url', 'jetpackcom_custom_form_redirect', 10, 3 );

Have a note to contribute?