wp_prototype_before_jquery

The timeline below displays how wordpress function wp_prototype_before_jquery has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Reorders JavaScript scripts array to place prototype before jQuery.
 *
 * @since 2.3.1
 *
 * @param string[] $js_array JavaScript scripts array
 * @return string[] Reordered array, if needed.
 */
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;
}

WordPress Version: 5.3

/**
 * Reorder JavaScript scripts array to place prototype before jQuery.
 *
 * @since 2.3.1
 *
 * @param array $js_array JavaScript scripts array
 * @return array Reordered array, if needed.
 */
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;
}

WordPress Version: 3.7

/**
 * Reorder JavaScript scripts array to place prototype before jQuery.
 *
 * @since 2.3.1
 *
 * @param array $js_array JavaScript scripts array
 * @return array Reordered array, if needed.
 */
function wp_prototype_before_jquery($js_array)
{
    if (false === $prototype = array_search('prototype', $js_array, true)) {
        return $js_array;
    }
    if (false === $jquery = array_search('jquery', $js_array, true)) {
        return $js_array;
    }
    if ($prototype < $jquery) {
        return $js_array;
    }
    unset($js_array[$prototype]);
    array_splice($js_array, $jquery, 0, 'prototype');
    return $js_array;
}