Title: wp_enqueue_script missing dependency
Last modified: August 20, 2016

---

# wp_enqueue_script missing dependency

 *  [Aaron D. Campbell](https://wordpress.org/support/users/aaroncampbell/)
 * (@aaroncampbell)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/wp_enqueue_script-missing-dependency/)
 * When you enqueue simple-pull-quote.js you should set ‘quicktags’ as a dependency
   since it needs the ‘edButtons’ variable that is created there. Adding one more
   parameter with to the call takes care of it:
 *     ```
       function simplePullQuotes() {
       	wp_enqueue_script(
       		'simple-pull-quotes',
       		plugin_dir_url(__FILE__) . 'simple-pull-quote.js',
       		array('quicktags')
       	);
       }
       ```
   
 * Without that, the button on the HTML editor doesn’t work if the pull-quote JS
   is loaded before quicktags. Also, on many pages it causes a JS error which makes
   the flyout nav not work properly.
 * Another suggestion would be to write a function to determine if that JS should
   be loaded (only needed if there’s an editor to add buttons to). After the Deadline
   adds a button like you, and it uses a function like this to determine if it should:
 *     ```
       /* Helper used to check if javascript should be added to page. Helps avoid bloat in admin */
       function AtD_should_load_on_page() {
       	global $pagenow, $current_screen;
   
       	$pages = array( 'post.php', 'post-new.php', 'page.php', 'page-new.php', 'admin.php', 'profile.php' );
   
       	if ( in_array( $pagenow, $pages ) ) {
       		if ( isset( $current_screen->post_type ) && $current_screen->post_type ) {
       			return post_type_supports( $current_screen->post_type, 'editor' );
       		}
       		return true;
       	}
   
       	return apply_filters( 'atd_load_scripts', false );
       }
       ```
   
 * [http://wordpress.org/extend/plugins/simple-pull-quote/](http://wordpress.org/extend/plugins/simple-pull-quote/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Toby Cryns (@themightymo)](https://wordpress.org/support/users/themightymo/)
 * (@themightymo)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/wp_enqueue_script-missing-dependency/#post-3222827)
 * [@aaroncampbell](https://wordpress.org/support/users/aaroncampbell/) – Thank 
   you so much for this advice and code samples. I will release a fix next week.

Viewing 1 replies (of 1 total)

The topic ‘wp_enqueue_script missing dependency’ is closed to new replies.

 * ![](https://ps.w.org/simple-pull-quote/assets/icon-256x256.png?rev=982362)
 * [Simple Pull Quote](https://wordpress.org/plugins/simple-pull-quote/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-pull-quote/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-pull-quote/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-pull-quote/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-pull-quote/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-pull-quote/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Toby Cryns (@themightymo)](https://wordpress.org/support/users/themightymo/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/wp_enqueue_script-missing-dependency/#post-3222827)
 * Status: not resolved