• Hi,

    So Contact Form 7 has the following bit of code:

    function wpcf7_recaptcha_enqueue_scripts() {
    	$service = WPCF7_RECAPTCHA::get_instance();
    
    	if ( ! $service->is_active() ) {
    		return;
    	}
    
    	$url = add_query_arg(
    		array(
    			'render' => $service->get_sitekey(),
    		),
    		'https://www.google.com/recaptcha/api.js'
    	);
    
    	wp_enqueue_script( 'google-recaptcha', $url, array(), '3.0', true );
    }

    I’m wanting to modify this function to add the following parameters to the import:

    data-cfasync="false" data-optimized="0" data-no-optimize="1"

    Essentially creating:

    <script type="text/javascript" src="https://www.google.com/recaptcha/api.js?render=STRINGHERE&ver=3.0" data-cfasync="false" data-optimized="0" data-no-optimize="1"></script>

    How would I do that?

    • This topic was modified 5 years, 4 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not a Developing with WordPress topic
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Adding extra parameters to wp_enqueue_script?’ is closed to new replies.