[wp-trac] [WordPress Trac] #55539: add_menu_page no longer renders base64 encoded SVG icon
WordPress Trac
noreply at wordpress.org
Thu Apr 7 07:50:30 UTC 2022
#55539: add_menu_page no longer renders base64 encoded SVG icon
----------------------------+------------------------------
Reporter: KProvance | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: trunk
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: administration
----------------------------+------------------------------
Changes (by kebbet):
* keywords: => needs-patch
* focuses: => administration
* version: => trunk
Comment:
Yes, can confirm this. Works in 5.9.3, not in current `trunk`.
Tested with this code.
{{{#!php
<?php
function register_menu_with_custom_svg_icon() {
//The icon in Base64 format
$icon_base64 =
'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI2LjEuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxhZ2VyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAyMCAyMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMjAgMjA7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7c3Ryb2tlOiNFMDEwMTA7c3Ryb2tlLXdpZHRoOjI7fQo8L3N0eWxlPgo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNMCwyaDIwIE0wLDEwaDIwIE0wLDE4aDIwIi8+Cjwvc3ZnPgo=';
//The icon in the data URI scheme
$icon_data_uri = 'data:image/svg+xml;base64,' . $icon_base64;
add_menu_page(
'Example',
'Example',
'manage_options',
'example',
'',
$icon_data_uri,
);
}
add_action( 'admin_menu', 'register_menu_with_custom_svg_icon' );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55539#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list