WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Easy Question: If I enqueue a script as follows:

Version A:

wp_enqueue_script('my-script', plugins_url( '/path/to/file', __FILE__ ), array('jquery', 'jquery-ui-core'));

Do I need to enqueue jquery and jquery-ui-core? As below:

Version B:

wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'jquery-ui-core' );
wp_enqueue_script('my-script', plugins_url( '/path/to/file', __FILE__ ), array('jquery', 'jquery-ui-core'));

Or does listing the scripts that it's dependent on (as in Version A) automatically handle that?

share|improve this question

You can use the first one, as long as the scripts have been registered, it will enqueue the dependencies prior if they haven't already. JQuery etc should already have been registered so version A is perfectly fine

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.