- $tabindex = ' tabindex="1"';
- $id = isset($item[5]) && ! empty($item[5]) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : '';
- $img = '';
- if ( isset($item[6]) && ! empty($item[6]) ) {
- if ( 'div' === $item[6] )
+ $id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : '';
+ $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.
+ // Dashicons and base64-encoded data:image/svg_xml URIs are also handled as special cases.
+ if ( ! empty( $item[6] ) ) {
+ $img = '<img src="' . $item[6] . '" alt="" />';
+
+ if ( 'none' === $item[6] || 'div' === $item[6] ) {
+ $img = '<br />';
+ } elseif ( 0 === strpos( $item[6], 'data:image/svg+xml;base64,' ) ) {