wp_prototype_before_jquery( array $js_array )

Reorder JavaScript scripts array to place prototype before jQuery.


Description Description


Parameters Parameters

$js_array

(array) (Required) JavaScript scripts array


Top ↑

Return Return

(array) Reordered array, if needed.


Top ↑

Source 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;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.3.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.