Make WordPress Core

Changeset 57159


Ignore:
Timestamp:
12/05/2023 01:37:52 PM (7 months ago)
Author:
SergeyBiryukov
Message:

Administration: Don't unnecessarily escape none or div in the admin menu.

This matches a similar conditional in wp-admin/menu-header.php, where these values are handled as special cases and don't output the default menu image so that an icon could be added to div.wp-menu-image as CSS background.

Follow-up to [9578], [21877], [26664].

Props andrewleap, ironprogrammer, azaozz.
Fixes #58361.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/menu.php

    r56598 r57159  
    128128    $menu_icon = 'dashicons-admin-post';
    129129    if ( is_string( $ptype_obj->menu_icon ) ) {
    130         // Special handling for data:image/svg+xml and Dashicons.
    131         if ( str_starts_with( $ptype_obj->menu_icon, 'data:image/svg+xml;base64,' ) || str_starts_with( $ptype_obj->menu_icon, 'dashicons-' ) ) {
     130        // Special handling for an empty div.wp-menu-image, data:image/svg+xml, and Dashicons.
     131        if ( 'none' === $ptype_obj->menu_icon || 'div' === $ptype_obj->menu_icon
     132            || str_starts_with( $ptype_obj->menu_icon, 'data:image/svg+xml;base64,' )
     133            || str_starts_with( $ptype_obj->menu_icon, 'dashicons-' )
     134        ) {
    132135            $menu_icon = $ptype_obj->menu_icon;
    133136        } else {
Note: See TracChangeset for help on using the changeset viewer.