[wp-trac] [WordPress Trac] #24834: wp_enqueue_script passing null for $ver produces unexpected results

WordPress Trac noreply at wordpress.org
Thu Jul 25 11:28:25 UTC 2013

#24834: wp_enqueue_script passing null for $ver produces unexpected results
 Reporter:  bobbingwide   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.5.2
 Severity:  normal        |   Keywords:
 This is a follow on to #16699.
 The documentation states that you can pass a null parameter as the version
 to prevent any version number being printed.
 See source (http://core.trac.wordpress.org/browser/trunk/wp-
 includes/functions.wp-scripts.php#L37 ) and codex
 (http://codex.wordpress.org/Function_Reference/wp_enqueue_script )

 In my experience passing null still produces a ver= query string
 which includes the original query string.
 There are also some unexpected changes to the original $src

 $src = "http://www.example.com/widget.js?token=something%3d%3d";
 wp_enqueue_script( $src, $src, array( "jquery"), null );

 <script type='text/javascript'
 There are two problems here
 1. the ver= parameter is still being created
 2. The %3d part of the token was unexpectedly capitalized to %3D in the
 first occurrence of token=

 The problem is in do_item() ( wp-includes/class.wp-scripts.php )

 The conversion of %3d to %3D is performed by add_query_arg('ver', $ver,
 Up to this point $src was the original (wanted) string.
 Had add_query_arg() not been invoked the $src would have been as required.

 My questions are these?
 Is this a bug in the code or a bug in the documentation?
 If not a bug in the code then HOW can I call wp_enqueue_script() so that
 my required $src IS respected?
 What if I really did require '%3d' to be passed as '%3d'?

Ticket URL: <http://core.trac.wordpress.org/ticket/24834>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list