wp_enqueue_script passing null for $ver produces unexpected results
|Reported by:||bobbingwide||Owned by:|
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 );
There are two problems here
- the ver= parameter is still being created
- 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, $src);
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'?
Change History (18)
comment:4 @pauldewouters — 21 months ago
comment:11 @nacin — 21 months ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
comment:13 in reply to: ↑ 10 @bobbingwide — 21 months ago
- Resolution invalid deleted
- Status changed from closed to reopened