Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Adding extra parameters to wp_enqueue_script?

$
0
0

Replies: 0

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?


Viewing all articles
Browse latest Browse all 59525

Trending Articles