Title: Adding extra parameters to wp_enqueue_script?
Last modified: October 26, 2019

---

# Adding extra parameters to wp_enqueue_script?

 *  [Ryder](https://wordpress.org/support/users/hyflex/)
 * (@hyflex)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/adding-extra-parameters-to-wp_enqueue_script/)
 * 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 6 years, 7 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
      Reason: Moved to Fixing WordPress, this is not a Developing with WordPress
      topic

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [6 years, 7 months ago](https://wordpress.org/support/topic/adding-extra-parameters-to-wp_enqueue_script/#post-12068146)
 * Moved to Fixing WordPress, this is not a Developing with WordPress topic.
 * Please ask plugin specific questions in that plugin’s dedicated sub-forum instead.
 * [https://wordpress.org/support/plugin/contact-form-7/#new-post](https://wordpress.org/support/plugin/contact-form-7/#new-post)
 *  Thread Starter [Ryder](https://wordpress.org/support/users/hyflex/)
 * (@hyflex)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/adding-extra-parameters-to-wp_enqueue_script/#post-12068306)
 * I disagree, this is specifically asking about adding parameters to an import 
   of wp_enqueue_script.
 * I simply added some example code and provided reasoning why.
 *  Thread Starter [Ryder](https://wordpress.org/support/users/hyflex/)
 * (@hyflex)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/adding-extra-parameters-to-wp_enqueue_script/#post-12088900)
 * Hi,
 * Anyone able to help with this as I still can’t find anything about using this
   wp_enqueue_script and adding more customization to the scripts.
 * Jan Dembowski has in my opinion moved this to the wrong forum as this was specifically
   about using a WP function.
 *  [A WP Life](https://wordpress.org/support/users/awordpresslife/)
 * (@awordpresslife)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/adding-extra-parameters-to-wp_enqueue_script/#post-12485848)
 * [@hyflex](https://wordpress.org/support/users/hyflex/) Did you get any solution
   on it?
 * We are also looking on it.
 *  Thread Starter [Ryder](https://wordpress.org/support/users/hyflex/)
 * (@hyflex)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/adding-extra-parameters-to-wp_enqueue_script/#post-12486410)
 * [@awordpresslife](https://wordpress.org/support/users/awordpresslife/) Nope, 
   Still looking… my search was wrongly halted by [@jdembowski](https://wordpress.org/support/users/jdembowski/)’
   s incorrect movement of this post.
 * It’s clearly a request for development help figuring out how to modify the wp_enqueue_script()
   function.
 *  [A WP Life](https://wordpress.org/support/users/awordpresslife/)
 * (@awordpresslife)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/adding-extra-parameters-to-wp_enqueue_script/#post-12487001)
 * We hope this will help you in your case: [https://wordpress.stackexchange.com/questions/359599/add-extra-parameter-in-script-tag-using-wp-enqueue-script/](https://wordpress.stackexchange.com/questions/359599/add-extra-parameter-in-script-tag-using-wp-enqueue-script/)
 * Thanks
 *  Thread Starter [Ryder](https://wordpress.org/support/users/hyflex/)
 * (@hyflex)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/adding-extra-parameters-to-wp_enqueue_script/#post-12490985)
 * Hey,
 * Thanks for that, that looks perfect! I’m surprised that the wp_enqueue_script
   doesn’t have the ability to add extra parameters by default.
 * Which one of the two did you use?
 *  [A WP Life](https://wordpress.org/support/users/awordpresslife/)
 * (@awordpresslife)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/adding-extra-parameters-to-wp_enqueue_script/#post-12491355)
 * Second one has maximum probability I think.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Adding extra parameters to wp_enqueue_script?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 2 participants
 * Last reply from: [A WP Life](https://wordpress.org/support/users/awordpresslife/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/adding-extra-parameters-to-wp_enqueue_script/#post-12491355)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
