wp_style_loader_src

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

WordPress Version: 5.5

/**
 * Administration Screen CSS for changing the styles.
 *
 * If installing the 'wp-admin/' directory will be replaced with './'.
 *
 * The $_wp_admin_css_colors global manages the Administration Screens CSS
 * stylesheet that is loaded. The option that is set is 'admin_color' and is the
 * color and key for the array. The value for the color key is an object with
 * a 'url' parameter that has the URL path to the CSS file.
 *
 * The query from $src parameter will be appended to the URL that is given from
 * the $_wp_admin_css_colors array value URL.
 *
 * @since 2.6.0
 *
 * @global array $_wp_admin_css_colors
 *
 * @param string $src    Source URL.
 * @param string $handle Either 'colors' or 'colors-rtl'.
 * @return string|false URL path to CSS stylesheet for Administration Screens.
 */
function wp_style_loader_src($src, $handle)
{
    global $_wp_admin_css_colors;
    if (wp_installing()) {
        return preg_replace('#^wp-admin/#', './', $src);
    }
    if ('colors' === $handle) {
        $color = get_user_option('admin_color');
        if (empty($color) || !isset($_wp_admin_css_colors[$color])) {
            $color = 'fresh';
        }
        $color = $_wp_admin_css_colors[$color];
        $url = $color->url;
        if (!$url) {
            return false;
        }
        $parsed = parse_url($src);
        if (isset($parsed['query']) && $parsed['query']) {
            wp_parse_str($parsed['query'], $qv);
            $url = add_query_arg($qv, $url);
        }
        return $url;
    }
    return $src;
}

WordPress Version: 5.3

/**
 * Administration Screen CSS for changing the styles.
 *
 * If installing the 'wp-admin/' directory will be replaced with './'.
 *
 * The $_wp_admin_css_colors global manages the Administration Screens CSS
 * stylesheet that is loaded. The option that is set is 'admin_color' and is the
 * color and key for the array. The value for the color key is an object with
 * a 'url' parameter that has the URL path to the CSS file.
 *
 * The query from $src parameter will be appended to the URL that is given from
 * the $_wp_admin_css_colors array value URL.
 *
 * @since 2.6.0
 * @global array $_wp_admin_css_colors
 *
 * @param string $src    Source URL.
 * @param string $handle Either 'colors' or 'colors-rtl'.
 * @return string|false URL path to CSS stylesheet for Administration Screens.
 */
function wp_style_loader_src($src, $handle)
{
    global $_wp_admin_css_colors;
    if (wp_installing()) {
        return preg_replace('#^wp-admin/#', './', $src);
    }
    if ('colors' === $handle) {
        $color = get_user_option('admin_color');
        if (empty($color) || !isset($_wp_admin_css_colors[$color])) {
            $color = 'fresh';
        }
        $color = $_wp_admin_css_colors[$color];
        $url = $color->url;
        if (!$url) {
            return false;
        }
        $parsed = parse_url($src);
        if (isset($parsed['query']) && $parsed['query']) {
            wp_parse_str($parsed['query'], $qv);
            $url = add_query_arg($qv, $url);
        }
        return $url;
    }
    return $src;
}

WordPress Version: 4.5

/**
 * Administration Screen CSS for changing the styles.
 *
 * If installing the 'wp-admin/' directory will be replaced with './'.
 *
 * The $_wp_admin_css_colors global manages the Administration Screens CSS
 * stylesheet that is loaded. The option that is set is 'admin_color' and is the
 * color and key for the array. The value for the color key is an object with
 * a 'url' parameter that has the URL path to the CSS file.
 *
 * The query from $src parameter will be appended to the URL that is given from
 * the $_wp_admin_css_colors array value URL.
 *
 * @since 2.6.0
 * @global array $_wp_admin_css_colors
 *
 * @param string $src    Source URL.
 * @param string $handle Either 'colors' or 'colors-rtl'.
 * @return string|false URL path to CSS stylesheet for Administration Screens.
 */
function wp_style_loader_src($src, $handle)
{
    global $_wp_admin_css_colors;
    if (wp_installing()) {
        return preg_replace('#^wp-admin/#', './', $src);
    }
    if ('colors' == $handle) {
        $color = get_user_option('admin_color');
        if (empty($color) || !isset($_wp_admin_css_colors[$color])) {
            $color = 'fresh';
        }
        $color = $_wp_admin_css_colors[$color];
        $url = $color->url;
        if (!$url) {
            return false;
        }
        $parsed = parse_url($src);
        if (isset($parsed['query']) && $parsed['query']) {
            wp_parse_str($parsed['query'], $qv);
            $url = add_query_arg($qv, $url);
        }
        return $url;
    }
    return $src;
}

WordPress Version: 4.4

/**
 * Administration Screen CSS for changing the styles.
 *
 * If installing the 'wp-admin/' directory will be replaced with './'.
 *
 * The $_wp_admin_css_colors global manages the Administration Screens CSS
 * stylesheet that is loaded. The option that is set is 'admin_color' and is the
 * color and key for the array. The value for the color key is an object with
 * a 'url' parameter that has the URL path to the CSS file.
 *
 * The query from $src parameter will be appended to the URL that is given from
 * the $_wp_admin_css_colors array value URL.
 *
 * @since 2.6.0
 * @global array $_wp_admin_css_colors
 *
 * @param string $src    Source URL.
 * @param string $handle Either 'colors' or 'colors-rtl'.
 * @return string|false URL path to CSS stylesheet for Administration Screens.
 */
function wp_style_loader_src($src, $handle)
{
    global $_wp_admin_css_colors;
    if (wp_installing()) {
        return preg_replace('#^wp-admin/#', './', $src);
    }
    if ('colors' == $handle) {
        $color = get_user_option('admin_color');
        if (empty($color) || !isset($_wp_admin_css_colors[$color])) {
            $color = 'fresh';
        }
        $color = $_wp_admin_css_colors[$color];
        $parsed = parse_url($src);
        $url = $color->url;
        if (!$url) {
            return false;
        }
        if (isset($parsed['query']) && $parsed['query']) {
            wp_parse_str($parsed['query'], $qv);
            $url = add_query_arg($qv, $url);
        }
        return $url;
    }
    return $src;
}

WordPress Version: 4.3

/**
 * Administration Screen CSS for changing the styles.
 *
 * If installing the 'wp-admin/' directory will be replaced with './'.
 *
 * The $_wp_admin_css_colors global manages the Administration Screens CSS
 * stylesheet that is loaded. The option that is set is 'admin_color' and is the
 * color and key for the array. The value for the color key is an object with
 * a 'url' parameter that has the URL path to the CSS file.
 *
 * The query from $src parameter will be appended to the URL that is given from
 * the $_wp_admin_css_colors array value URL.
 *
 * @since 2.6.0
 * @global array $_wp_admin_css_colors
 *
 * @param string $src    Source URL.
 * @param string $handle Either 'colors' or 'colors-rtl'.
 * @return string|false URL path to CSS stylesheet for Administration Screens.
 */
function wp_style_loader_src($src, $handle)
{
    global $_wp_admin_css_colors;
    if (defined('WP_INSTALLING')) {
        return preg_replace('#^wp-admin/#', './', $src);
    }
    if ('colors' == $handle) {
        $color = get_user_option('admin_color');
        if (empty($color) || !isset($_wp_admin_css_colors[$color])) {
            $color = 'fresh';
        }
        $color = $_wp_admin_css_colors[$color];
        $parsed = parse_url($src);
        $url = $color->url;
        if (!$url) {
            return false;
        }
        if (isset($parsed['query']) && $parsed['query']) {
            wp_parse_str($parsed['query'], $qv);
            $url = add_query_arg($qv, $url);
        }
        return $url;
    }
    return $src;
}

WordPress Version: 3.9

/**
 * Administration Screen CSS for changing the styles.
 *
 * If installing the 'wp-admin/' directory will be replaced with './'.
 *
 * The $_wp_admin_css_colors global manages the Administration Screens CSS
 * stylesheet that is loaded. The option that is set is 'admin_color' and is the
 * color and key for the array. The value for the color key is an object with
 * a 'url' parameter that has the URL path to the CSS file.
 *
 * The query from $src parameter will be appended to the URL that is given from
 * the $_wp_admin_css_colors array value URL.
 *
 * @since 2.6.0
 * @uses $_wp_admin_css_colors
 *
 * @param string $src Source URL.
 * @param string $handle Either 'colors' or 'colors-rtl'.
 * @return string URL path to CSS stylesheet for Administration Screens.
 */
function wp_style_loader_src($src, $handle)
{
    global $_wp_admin_css_colors;
    if (defined('WP_INSTALLING')) {
        return preg_replace('#^wp-admin/#', './', $src);
    }
    if ('colors' == $handle) {
        $color = get_user_option('admin_color');
        if (empty($color) || !isset($_wp_admin_css_colors[$color])) {
            $color = 'fresh';
        }
        $color = $_wp_admin_css_colors[$color];
        $parsed = parse_url($src);
        $url = $color->url;
        if (!$url) {
            return false;
        }
        if (isset($parsed['query']) && $parsed['query']) {
            wp_parse_str($parsed['query'], $qv);
            $url = add_query_arg($qv, $url);
        }
        return $url;
    }
    return $src;
}

WordPress Version: 3.8

/**
 * Administration Screen CSS for changing the styles.
 *
 * If installing the 'wp-admin/' directory will be replaced with './'.
 *
 * The $_wp_admin_css_colors global manages the Administration Screens CSS
 * stylesheet that is loaded. The option that is set is 'admin_color' and is the
 * color and key for the array. The value for the color key is an object with
 * a 'url' parameter that has the URL path to the CSS file.
 *
 * The query from $src parameter will be appended to the URL that is given from
 * the $_wp_admin_css_colors array value URL.
 *
 * @since 2.6.0
 * @uses $_wp_admin_css_colors
 *
 * @param string $src Source URL.
 * @param string $handle Either 'colors' or 'colors-rtl'.
 * @return string URL path to CSS stylesheet for Administration Screens.
 */
function wp_style_loader_src($src, $handle)
{
    if (defined('WP_INSTALLING')) {
        return preg_replace('#^wp-admin/#', './', $src);
    }
    if ('colors' == $handle || 'colors-rtl' == $handle) {
        global $_wp_admin_css_colors;
        $color = get_user_option('admin_color');
        if (empty($color) || !isset($_wp_admin_css_colors[$color])) {
            $color = 'fresh';
        }
        $color = $_wp_admin_css_colors[$color];
        $parsed = parse_url($src);
        $url = $color->url;
        if (isset($parsed['query']) && $parsed['query']) {
            wp_parse_str($parsed['query'], $qv);
            $url = add_query_arg($qv, $url);
        }
        return $url;
    }
    return $src;
}

WordPress Version: 3.7

/**
 * Administration Screen CSS for changing the styles.
 *
 * If installing the 'wp-admin/' directory will be replaced with './'.
 *
 * The $_wp_admin_css_colors global manages the Administration Screens CSS
 * stylesheet that is loaded. The option that is set is 'admin_color' and is the
 * color and key for the array. The value for the color key is an object with
 * a 'url' parameter that has the URL path to the CSS file.
 *
 * The query from $src parameter will be appended to the URL that is given from
 * the $_wp_admin_css_colors array value URL.
 *
 * @since 2.6.0
 * @uses $_wp_admin_css_colors
 *
 * @param string $src Source URL.
 * @param string $handle Either 'colors' or 'colors-rtl'.
 * @return string URL path to CSS stylesheet for Administration Screens.
 */
function wp_style_loader_src($src, $handle)
{
    if (defined('WP_INSTALLING')) {
        return preg_replace('#^wp-admin/#', './', $src);
    }
    if ('colors' == $handle || 'colors-rtl' == $handle) {
        global $_wp_admin_css_colors;
        $color = get_user_option('admin_color');
        if (empty($color) || !isset($_wp_admin_css_colors[$color])) {
            $color = 'fresh';
        }
        $color = $_wp_admin_css_colors[$color];
        $parsed = parse_url($src);
        $url = $color->url;
        if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
            $url = preg_replace('/.min.css$|.min.css(?=\?)/', '.css', $url);
        }
        if (isset($parsed['query']) && $parsed['query']) {
            wp_parse_str($parsed['query'], $qv);
            $url = add_query_arg($qv, $url);
        }
        return $url;
    }
    return $src;
}