wp_prototype_before_jquery() WordPress Function
The wp_prototype_before_jquery() function is used to load the Prototype JavaScript library before jQuery. This is necessary when using certain plugins that require Prototype.
wp_prototype_before_jquery( array $js_array ) #
Reorders JavaScript scripts array to place prototype before jQuery.
Contents
Parameters
- $js_array
(array)(Required)JavaScript scripts array
Return
(array) Reordered array, if needed.
Source
File: wp-includes/script-loader.php
function wp_prototype_before_jquery( $js_array ) {
$prototype = array_search( 'prototype', $js_array, true );
if ( false === $prototype ) {
return $js_array;
}
$jquery = array_search( 'jquery', $js_array, true );
if ( false === $jquery ) {
return $js_array;
}
if ( $prototype < $jquery ) {
return $js_array;
}
unset( $js_array[ $prototype ] );
array_splice( $js_array, $jquery, 0, 'prototype' );
return $js_array;
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 2.3.1 | Introduced. |