Skip to content

Instantly share code, notes, and snippets.

@brandwaffle
Created May 15, 2012 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandwaffle/2703013 to your computer and use it in GitHub Desktop.
Save brandwaffle/2703013 to your computer and use it in GitHub Desktop.
wp_enqueue_script that converts a string $deps to an array with a single element
Index: functions.wp-scripts.php
===================================================================
--- functions.wp-scripts.php (revision 20792)
+++ functions.wp-scripts.php (working copy)
@@ -131,6 +131,11 @@
$wp_scripts = new WP_Scripts();
}
+ //if a single param is passed as the dependency, convert to an array so WP_Dependencies won't convert
+ //it to an empty array
+ if( !is_array( $deps ) )
+ $deps = (array) $deps;
+
if ( $src ) {
$_handle = explode('?', $handle);
$wp_scripts->add( $_handle[0], $src, $deps, $ver );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment