File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -3442,9 +3442,11 @@ function wp_enqueue_command_palette_assets() {
34423442 }
34433443
34443444 // Remove all HTML tags and their contents.
3445- $ menu_label = $ menu_item [0 ];
3446- while ( preg_match ( '/<[^>]*>/ ' , $ menu_label ) ) {
3447- $ menu_label = preg_replace ( '/<[^>]*>.*?<\/[^>]*>|<[^>]*\/>|<[^>]*>/s ' , '' , $ menu_label );
3445+ $ processor = new WP_HTML_Tag_Processor ( $ menu_item [0 ] );
3446+ while ( $ processor ->next_token () ) {
3447+ if ( '#text ' === $ processor ->get_token_name () ) {
3448+ $ menu_label .= $ processor ->get_modifiable_text ();
3449+ }
34483450 }
34493451 $ menu_label = trim ( $ menu_label );
34503452 $ menu_url = '' ;
@@ -3471,9 +3473,12 @@ function wp_enqueue_command_palette_assets() {
34713473 }
34723474
34733475 // Remove all HTML tags and their contents.
3474- $ submenu_label = $ submenu_item [0 ];
3475- while ( preg_match ( '/<[^>]*>/ ' , $ submenu_label ) ) {
3476- $ submenu_label = preg_replace ( '/<[^>]*>.*?<\/[^>]*>|<[^>]*\/>|<[^>]*>/s ' , '' , $ submenu_label );
3476+ $ processor = new WP_HTML_Tag_Processor ( $ submenu_item [0 ] );
3477+ $ submenu_label = '' ;
3478+ while ( $ processor ->next_token () ) {
3479+ if ( '#text ' === $ processor ->get_token_name () ) {
3480+ $ submenu_label .= $ processor ->get_modifiable_text ();
3481+ }
34773482 }
34783483 $ submenu_label = trim ( $ submenu_label );
34793484 $ submenu_url = '' ;
You can’t perform that action at this time.
0 commit comments