[wp-hackers] wp_enqueue_script() and URLs with 2+

andré renaut andre.renaut at gmail.com
Sat Feb 28 00:53:10 GMT 2009

Hi, was just looking at your problem,

In analyzing the code of WP i found some restrictions between
wp_register_script and the WP_Scripts class (extending WP_Dependencies)

In fact, wp_register script

function wp_register_script
<>( $handle
<>, $src
<>, $deps
<> = array(), $ver
<> = false )

is using the add function af WP_Dependencies

function add <>( $handle
<>, $src
<>, $deps
<> = array(), $ver
<> = false, $args
<> = null )

The difference between the two is that wp_register_script do not use
the $args argument

to bypass this do as follow :

global $wp_scripts;
if ( !is_a($wp_scripts, 'WP_Scripts') )
    $wp_scripts = new WP_Scripts();

$wp_scripts->add( $handle, $src, $deps, $ver, $args);

$args should be something like 'A=xxxx&amp;B=yyy&amp;C=zzz...'

More information about the wp-hackers mailing list