Viewing 2 replies - 1 through 2 (of 2 total)

  • function cf7_custom_form_url( $form_url ) {

    global $post;

    //The page id where the form is
    $form_page_id = 18;

    if ( $post->ID === $form_page_id ) {
    return 'https://www.mywebsite.com/externalurl/';
    }
    else{
    return $form_url;
    }

    }
    add_filter( 'wpcf7_form_action_url', 'cf7_custom_form_url' );

    Thread Starter kudu-digital

    (@kudu-digital)

    Thank you for the quick response!

    – Where should I place this code exactly? in the Additionnal settings of Contact Form 7, right? Somehow it doesn’t get triggered by the submit button.
    – page id: should this be the wordpress page ID or the form ID? I tried with both
    – I guess I should replace form_url with my own variable from the form?

    I tried all of this but nothing happen. I do not understand how this could redirect the user on an external page with the right zip code.

    I tried this

    function cf7_custom_form_url( $zip-code) {

    global $post;

    //The page id where the form is
    $form_page_id = 27;

    if ( $post->ID === $form_page_id ) {
    return ‘https://www.rehabs.com/find-a-rehab/?loc=’;
    }
    else{
    return $zip-code;
    }

    }
    add_filter( ‘wpcf7_form_action_url’, ‘cf7_custom_form_url’ );

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Redirect to an external URL with form input’ is closed to new replies.