• I was working on on-site speed optimization. I removed the CSS and js files of the Contact Form 7 plugin. Through the following code in function.php.

    function rjs_lwp_contactform_css_js() {
            global $post;
            if( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'contact-form-7') ) {
                wp_enqueue_script('contact-form-7');
                 wp_enqueue_style('contact-form-7');
        
            }else{
                wp_dequeue_script( 'contact-form-7' );
                wp_dequeue_style( 'contact-form-7' );
            }
        }
        add_action( 'wp_enqueue_scripts', 'rjs_lwp_contactform_css_js');

    As a result, I can’t access the Thank you page. Mail goes correctly, but is not redirected to the “thank you page”. Showing Error after root domain: abc.com/#wpcf7-f139-o1 etc. How it is possible if I removed both files and the page also redirect.

    I set Redirect Code in the Form

    <script>
    document.addEventListener( 'wpcf7mailsent', function( event ) {
        location = '/thank-you/';
    }, false );
    </script>
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Contact Form 7 is not redirecting the “Thank-You” page’ is closed to new replies.