Skip to content

Commit ba355f0

Browse files
authored
Simplify admin-bar.php function
1 parent 4eeb0b7 commit ba355f0

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

src/wp-includes/admin-bar.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,27 +1442,20 @@ function _get_admin_bar_pref( $context = 'front', $user = 0 ) {
14421442
* Enqueues the admin bar color scheme stylesheet on the front end.
14431443
*
14441444
* @since 7.0.0
1445-
*
1446-
* @global array $_wp_admin_css_colors Registered administration color schemes.
14471445
*/
14481446
function wp_admin_bar_add_color_scheme_to_front_end() {
14491447
if ( is_admin() ) {
14501448
return;
14511449
}
14521450

1453-
global $_wp_admin_css_colors;
1454-
1455-
if ( empty( $_wp_admin_css_colors ) ) {
1456-
register_admin_color_schemes();
1457-
}
1458-
14591451
$color_scheme = get_user_option( 'admin_color' );
14601452

1461-
if ( empty( $color_scheme ) || ! isset( $_wp_admin_css_colors[ $color_scheme ] ) ) {
1462-
$color_scheme = 'modern';
1453+
if ( empty( $color_scheme ) || ! in_array( 'modern', 'light', 'blue', 'coffee', 'ectoplasm', 'midnight', 'ocean', 'sunrise' ) ) {
1454+
return;
14631455
}
14641456

1465-
$admin_bar_url = $_wp_admin_css_colors[ $color_scheme ]->admin_bar_url ?? false;
1457+
$suffix = SCRIPT_DEBUG ? '' : '.min';
1458+
$admin_bar_url = admin_url( 'css/colors/' . $color_scheme . "/admin-bar$suffix.css" );
14661459

14671460
if ( ! $admin_bar_url ) {
14681461
return;

0 commit comments

Comments
 (0)