diff --git a/src/wp-admin/css/wp-admin.css b/src/wp-admin/css/wp-admin.css
index 01b922aec1..a2e33f3739 100644
--- a/src/wp-admin/css/wp-admin.css
+++ b/src/wp-admin/css/wp-admin.css
@@ -1874,6 +1874,8 @@ form.upgrade .hint {
width: 34px;
height: 30px;
margin: 0;
+ background-repeat: no-repeat;
+ background-position: center;
text-align: center;
}
diff --git a/src/wp-admin/includes/misc.php b/src/wp-admin/includes/misc.php
index 6f0ad5e40c..5091908cf2 100644
--- a/src/wp-admin/includes/misc.php
+++ b/src/wp-admin/includes/misc.php
@@ -618,9 +618,21 @@ function wp_color_scheme_settings() {
$color_scheme = get_user_option( 'admin_color' );
- if ( ! empty( $_wp_admin_css_colors[ $color_scheme ]->icon_colors ) ) {
- echo '\n";
+ // It's possible to have a color scheme set that is no longer registered.
+ if ( empty( $_wp_admin_css_colors[ $color_scheme ] ) ) {
+ $color_scheme = 'fresh';
}
+
+ if ( ! empty( $_wp_admin_css_colors[ $color_scheme ]->icon_colors ) ) {
+ $icon_colors = $_wp_admin_css_colors[ $color_scheme ]->icon_colors;
+ } elseif ( ! empty( $_wp_admin_css_colors['fresh']->icon_colors ) ) {
+ $icon_colors = $_wp_admin_css_colors['fresh']->icon_colors;
+ } else {
+ // Fall back to the default set of icon colors if the default scheme is missing.
+ $icon_colors = array( 'base' => '#999', 'focus' => '#2ea2cc', 'current' => '#fff' );
+ }
+
+ echo '\n";
}
add_action( 'admin_head', 'wp_color_scheme_settings' );
diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php
index 09142fb506..b163373433 100644
--- a/src/wp-admin/includes/plugin.php
+++ b/src/wp-admin/includes/plugin.php
@@ -966,8 +966,11 @@ function uninstall_plugin($plugin) {
* @param string $capability The capability required for this menu to be displayed to the user.
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
- * @param string $icon_url The url to the icon to be used for this menu. Using 'none' would leave div.wp-menu-image empty
- * so an icon can be added as background with CSS.
+ * @param string $icon_url The url to the icon to be used for this menu.
+ * * Pass a base64-encoded SVG using a data URI, which will be colored to match the color scheme.
+ * This should begin with 'data:image/svg+xml;base64,'.
+ * * Pass the name of a Dashicons helper class to use a font icon, e.g. 'dashicons-piechart'.
+ * * Pass 'none' to leave div.wp-menu-image empty so an icon can be added via CSS.
* @param int $position The position in the menu order this one should appear
*
* @return string The resulting page's hook_suffix
diff --git a/src/wp-admin/menu-header.php b/src/wp-admin/menu-header.php
index ede610e291..ab219683d4 100644
--- a/src/wp-admin/menu-header.php
+++ b/src/wp-admin/menu-header.php
@@ -67,11 +67,24 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
$id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : '';
- $img = '';
+ $img = $img_style = $img_class = '';
+
// if the string 'none' (previously 'div') is passed instead of an URL, don't output the default menu image
// so an icon can be added to div.wp-menu-image as background with CSS.
- if ( ! empty( $item[6] ) )
- $img = ( 'none' === $item[6] || 'div' === $item[6] ) ? '
' : '';
+ // Dashicons and base64-encoded data:image/svg_xml URIs are also handled as special cases.
+ if ( ! empty( $item[6] ) ) {
+ $img = '';
+
+ if ( 'none' === $item[6] || 'div' === $item[6] ) {
+ $img = '
';
+ } elseif ( 0 === strpos( $item[6], 'data:image/svg+xml;base64,' ) ) {
+ $img = '
';
+ $img_style = ' style="background-image:url(\'' . esc_attr( $item[6] ) . '\')"';
+ } elseif ( 0 === strpos( $item[6], 'dashicons-' ) ) {
+ $img = '
';
+ $img_class = ' dashicons ' . sanitize_html_class( $item[6] );
+ }
+ }
$arrow = '