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?
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