• ReCaptcha not working when get_header() called after get_template_part( 'template-parts/content').

    In many themes get_header() called after generating content for different reasons (in our case we want to use wp_enqueue_script/wp_enqueue_style in parts).
    Example for singular.php change:

    <?php
    /**
     * The template for displaying single posts and pages.
     *
     * @link https://developer.www.ads-software.com/themes/basics/template-hierarchy/
     *
     * @package WordPress
     * @subpackage Twenty_Twenty
     * @since Twenty Twenty 1.0
     */
    
    ob_start();
    ?>
    
    <main id="site-content" role="main">
    	<?php
    	if ( have_posts() ) {
    		while ( have_posts() ) {
    			the_post();
    			get_template_part( 'template-parts/content', get_post_type() );
    		}
    	}
    	?>
    </main><!-- #site-content -->
    <?php get_template_part( 'template-parts/footer-menus-widgets' ); ?>
    
    <?php $content = ob_get_clean(); ?>
    <?php get_header(); ?>
    <?php echo $content ?>
    <?php get_footer(); ?>

    Issue caused by this code:

    if ( ! wp_script_is( 'google-recaptcha', 'registered' ) && function_exists( 'wpcf7_recaptcha_enqueue_scripts' ) ) {
    	wpcf7_recaptcha_enqueue_scripts();
    }

    So it enqueues default CF url for ‘google-recaptcha’.

    Please fix this by calling iqfix_wpcf7_recaptcha_enqueue_scripts() if recaptcha v2 is enabled.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author IQComputing

    (@iqcomputing)

    Hello,

    Thank you for providing this information! We’ll attempt to replicate the issue you’re running into on our end and see if there’s a proper patch that can be put into place.

    Thread Starter AndriiP

    (@andruhapx)

    Welcome. In other issues I saw that another people expiriencing the same issue. Recaptcha js is added via v3 way, so captcha is not displayed and js load failed with status 400.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘ReCaptcha not working when get_header(); called after content’ is closed to new replies.