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.
Built from https://develop.svn.wordpress.org/trunk@57159


git-svn-id: http://core.svn.wordpress.org/trunk@56670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2023-12-05 13:39:28 +00:00
parent 65bbe06a00
commit 7eec58966d
2 changed files with 6 additions and 3 deletions

View File

@ -127,8 +127,11 @@ foreach ( array_merge( $builtin, $types ) as $ptype ) {
$menu_icon = 'dashicons-admin-post'; $menu_icon = 'dashicons-admin-post';
if ( is_string( $ptype_obj->menu_icon ) ) { if ( is_string( $ptype_obj->menu_icon ) ) {
// Special handling for data:image/svg+xml and Dashicons. // Special handling for an empty div.wp-menu-image, data:image/svg+xml, and Dashicons.
if ( str_starts_with( $ptype_obj->menu_icon, 'data:image/svg+xml;base64,' ) || str_starts_with( $ptype_obj->menu_icon, 'dashicons-' ) ) { if ( 'none' === $ptype_obj->menu_icon || 'div' === $ptype_obj->menu_icon
|| str_starts_with( $ptype_obj->menu_icon, 'data:image/svg+xml;base64,' )
|| str_starts_with( $ptype_obj->menu_icon, 'dashicons-' )
) {
$menu_icon = $ptype_obj->menu_icon; $menu_icon = $ptype_obj->menu_icon;
} else { } else {
$menu_icon = esc_url( $ptype_obj->menu_icon ); $menu_icon = esc_url( $ptype_obj->menu_icon );

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.5-alpha-57158'; $wp_version = '6.5-alpha-57159';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.