Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Evan Herman

    (@eherman24)

    Hi Agenciahouse,

    Yes, you can add some variables to the redirect URL using the provided yikes-mailchimp-redirect-url filter.

    The following snippet should work for appending additional variables onto the URL.

    Feel free to alter the snippet as needed:

    function yikes_mailchimp_append_query_args_redirect_url( $url, $form_id, $page_data ) {
        $url = add_query_arg( array(
    		'variable1' => 'true',
    		// 'variable2' => 'false',
    	), $url );
    	return esc_url( $url );
    }
    add_filter( 'yikes-mailchimp-redirect-url', 'append_query_args_redirect_url', 10, 3 );

    You’ll want to add that code snippet to the bottom of your active themes functions.php file. Once added, all of your forms will append the variables onto the URL after a successful form submission.

    Please note, at the moment non-ajax redirects seem to be having an issue. I am currently working on a patch that will get things working again. When that patch is out, the snippet above will work on Non-AJAX forms as well.

    Thanks,
    Evan

    Thread Starter Helison Santos

    (@agenciahouse)

    Hi, Evan

    It did not work as described by you , and also caused other forms also stop redirect . Even with the AJAX option disabled.

    https://meditandonodiaadia.com/teste/

    function yikes_mailchimp_append_query_args_redirect_url( $url, $form_id, $page_data ) {
        $url = add_query_arg( array(
    		'FNAME' => 'true',
    		// 'variable2' => 'false',
    	), $url);
    	return esc_url( $url );
    }
    add_filter( 'yikes-mailchimp-redirect-url', 'append_query_args_redirect_url', 10, 3 );
    Plugin Author Evan Herman

    (@eherman24)

    Hi,

    I just did some testing and it appeared to work on my end.

    You need to update the function name inside of the filter callback.

    function yikes_mailchimp_append_query_args_redirect_url( $url, $form_id, $page_data ) {
        $url = add_query_arg( array(
    		'variable1' => 'true',
    		// 'variable2' => 'false',
    	), $url );
    	return esc_url( $url );
    }
    add_filter( 'yikes-mailchimp-redirect-url', 'yikes_mailchimp_append_query_args_redirect_url', 10, 3 );

    Thanks,
    Evan

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Redirect with variable?’ is closed to new replies.