From 82ad5086c745af88f906cf9dfe37c04df2f337c8 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Fri, 24 Apr 2026 11:39:31 +1000 Subject: [PATCH 01/19] Determine correct command palette label via JS. --- src/wp-includes/admin-bar.php | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index b9c7872d0cc07..edd56fb35a965 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -949,11 +949,13 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { return; } - $is_apple_os = (bool) preg_match( '/Macintosh|Mac OS X|Mac_PowerPC/i', $_SERVER['HTTP_USER_AGENT'] ?? '' ); - $shortcut_label = $is_apple_os - ? _x( '⌘K', 'keyboard shortcut to open the command palette' ) - : _x( 'Ctrl+K', 'keyboard shortcut to open the command palette' ); - $title = sprintf( + $shortcut_labels = array( + 'appleOS' => _x( '⌘K', 'keyboard shortcut to open the command palette' ), + 'default' => _x( 'Ctrl+K', 'keyboard shortcut to open the command palette' ), + ); + $is_apple_os = (bool) preg_match( '/Macintosh|Mac OS X|Mac_PowerPC/i', $_SERVER['HTTP_USER_AGENT'] ?? '' ); + $shortcut_label = $is_apple_os ? $shortcut_labels['appleOS'] : $shortcut_labels['default']; + $title = sprintf( '%s %s', $shortcut_label, /* translators: Hidden accessibility text. */ @@ -970,6 +972,27 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { ), ) ); + + $script = << { + let userAgent = ''; + // Assigning agent may error if the HTTP header is blocked at the browser level. + try { + userAgent = navigator.userAgent; + } catch (error) { + // Make no change to the default shortcut label. + return; + } + const isAppleOS = /Macintosh|Mac OS X|Mac_PowerPC/i.test( userAgent ); + const shortcutLabel = isAppleOS ? shortCutLabels.appleOS : shortCutLabels.default; + const commandPaletteNode = document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' ); + if ( commandPaletteNode ) { + commandPaletteNode.textContent = shortcutLabel; + } + }) +JS; + $script .= '(' . wp_json_encode( $shortcut_labels ) . ');'; + wp_add_inline_script( 'admin-bar', $script ); } /** From 09b17fe3c5c44d8b89ed1da4cbbd469a3602b83d Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Fri, 24 Apr 2026 11:58:38 +1000 Subject: [PATCH 02/19] Slightly neater. --- src/wp-includes/admin-bar.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index edd56fb35a965..a0abdd1b0f966 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -975,10 +975,9 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { $script = << { - let userAgent = ''; // Assigning agent may error if the HTTP header is blocked at the browser level. try { - userAgent = navigator.userAgent; + const userAgent = navigator.userAgent; } catch (error) { // Make no change to the default shortcut label. return; From 321519abb730b5589888b566baf539c29b4b69fa Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Fri, 24 Apr 2026 12:02:56 +1000 Subject: [PATCH 03/19] Explain why wp-i18n is not used. --- src/wp-includes/admin-bar.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index a0abdd1b0f966..391a16a275e5f 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -973,6 +973,15 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { ) ); + /* + * The script is added as an inline script to avoid an additional dependency. + * + * Adding the code within the admin-bar script would require the wp-i18n script to be loaded + * as a dependency. While this is widely available in the admin, the wp-i18n script is not + * commonly required on the front end of the site. As the command palette is not available + * on the front-end, the script would be loaded but remain unused on the front-end of + * a website. + */ $script = << { // Assigning agent may error if the HTTP header is blocked at the browser level. From f7a5520c0ab5afb60a5c1d8645d4247701ba5357 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Fri, 24 Apr 2026 12:12:40 +1000 Subject: [PATCH 04/19] Revert "Slightly neater." because it breaks all things scope related. This reverts commit 25015a63cc9c70007defb8d8d6666fe537cf7b5e. --- src/wp-includes/admin-bar.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index 391a16a275e5f..d055712eb19ee 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -984,9 +984,10 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { */ $script = << { + let userAgent = ''; // Assigning agent may error if the HTTP header is blocked at the browser level. try { - const userAgent = navigator.userAgent; + userAgent = navigator.userAgent; } catch (error) { // Make no change to the default shortcut label. return; From aeca82574b80d0694a7deec54990c0d0aaa1c151 Mon Sep 17 00:00:00 2001 From: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com> Date: Fri, 24 Apr 2026 12:20:07 +1000 Subject: [PATCH 05/19] Apply suggestions from code review Co-authored-by: Weston Ruter --- src/wp-includes/admin-bar.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index d055712eb19ee..c4c4469238113 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -982,7 +982,7 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { * on the front-end, the script would be loaded but remain unused on the front-end of * a website. */ - $script = << { let userAgent = ''; // Assigning agent may error if the HTTP header is blocked at the browser level. @@ -999,7 +999,7 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { commandPaletteNode.textContent = shortcutLabel; } }) -JS; + JS; $script .= '(' . wp_json_encode( $shortcut_labels ) . ');'; wp_add_inline_script( 'admin-bar', $script ); } From 6c1658dba4bd051c526895e6354ae65bb655b2a9 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Fri, 24 Apr 2026 12:27:16 +1000 Subject: [PATCH 06/19] Shortcut as one word in all instances. --- src/wp-includes/admin-bar.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index c4c4469238113..e44f76421fac6 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -983,7 +983,7 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { * a website. */ $script = <<<'JS' - (( shortCutLabels ) => { + (( shortcutLabels ) => { let userAgent = ''; // Assigning agent may error if the HTTP header is blocked at the browser level. try { @@ -993,7 +993,7 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { return; } const isAppleOS = /Macintosh|Mac OS X|Mac_PowerPC/i.test( userAgent ); - const shortcutLabel = isAppleOS ? shortCutLabels.appleOS : shortCutLabels.default; + const shortcutLabel = isAppleOS ? shortcutLabels.appleOS : shortcutLabels.default; const commandPaletteNode = document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' ); if ( commandPaletteNode ) { commandPaletteNode.textContent = shortcutLabel; From b59981374502dbf7f49f40b06a446e3ea6f7ad1a Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Sun, 26 Apr 2026 08:33:15 +1000 Subject: [PATCH 07/19] Relocate script before adding node. --- src/wp-includes/admin-bar.php | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index e44f76421fac6..aa441f1df28dc 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -961,18 +961,6 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { /* translators: Hidden accessibility text. */ __( 'Open command palette' ), ); - $wp_admin_bar->add_node( - array( - 'id' => 'command-palette', - 'title' => $title, - 'href' => '#', - 'meta' => array( - 'class' => 'hide-if-no-js', - 'onclick' => 'wp.data.dispatch( "core/commands" ).open(); return false;', - ), - ) - ); - /* * The script is added as an inline script to avoid an additional dependency. * @@ -1001,7 +989,17 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { }) JS; $script .= '(' . wp_json_encode( $shortcut_labels ) . ');'; - wp_add_inline_script( 'admin-bar', $script ); + $wp_admin_bar->add_node( + array( + 'id' => 'command-palette', + 'title' => $title, + 'href' => '#', + 'meta' => array( + 'class' => 'hide-if-no-js', + 'onclick' => 'wp.data.dispatch( "core/commands" ).open(); return false;', + ), + ) + ); } /** From d8172eef754b03be3730a19f2e656468ac2f0e96 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Sun, 26 Apr 2026 09:16:59 +1000 Subject: [PATCH 08/19] MIsc changes. --- src/wp-includes/admin-bar.php | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index aa441f1df28dc..ac51f56747a94 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -962,33 +962,24 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { __( 'Open command palette' ), ); /* - * The script is added as an inline script to avoid an additional dependency. + * Detect Apple OS via JavaScript for users behind a CDN blocking the UA header. * - * Adding the code within the admin-bar script would require the wp-i18n script to be loaded - * as a dependency. While this is widely available in the admin, the wp-i18n script is not - * commonly required on the front end of the site. As the command palette is not available - * on the front-end, the script would be loaded but remain unused on the front-end of - * a website. + * Running the script as the admin bar is rendered avoids a flash of incorrect content + * for users with Apple OS when the UA header is blocked. It also prevents the need for + * wp-i18n to be loaded as a dependency as it is most likely not included on the front + * end of a site. */ $script = <<<'JS' (( shortcutLabels ) => { - let userAgent = ''; - // Assigning agent may error if the HTTP header is blocked at the browser level. - try { - userAgent = navigator.userAgent; - } catch (error) { - // Make no change to the default shortcut label. + const isAppleOS = navigator.platform.startsWith("Mac") || navigator.platform === "iPhone" || navigator.platform === "iPad"; + if ( ! isAppleOS ) { return; } - const isAppleOS = /Macintosh|Mac OS X|Mac_PowerPC/i.test( userAgent ); - const shortcutLabel = isAppleOS ? shortcutLabels.appleOS : shortcutLabels.default; - const commandPaletteNode = document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' ); - if ( commandPaletteNode ) { - commandPaletteNode.textContent = shortcutLabel; - } + document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' ).textContent = shortcutLabels.appleOS; }) JS; - $script .= '(' . wp_json_encode( $shortcut_labels ) . ');'; + $script .= '(' . wp_json_encode( $shortcut_labels, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) . ');'; + $script .= "\n//# sourceURL=wp_admin_bar_command_palette_menu"; $wp_admin_bar->add_node( array( 'id' => 'command-palette', @@ -997,6 +988,7 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { 'meta' => array( 'class' => 'hide-if-no-js', 'onclick' => 'wp.data.dispatch( "core/commands" ).open(); return false;', + 'html' => '', ), ) ); From 634d77aab30294b3af206ae2b56f44204d4a6969 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Sun, 26 Apr 2026 09:25:12 +1000 Subject: [PATCH 09/19] Avoid concatination. --- src/wp-includes/admin-bar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index ac51f56747a94..50cb5a6cc5f61 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -988,7 +988,7 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { 'meta' => array( 'class' => 'hide-if-no-js', 'onclick' => 'wp.data.dispatch( "core/commands" ).open(); return false;', - 'html' => '', + 'html' => "", ), ) ); From 42da05d56c518b15d186a800b97f68cbac70a6d4 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Sun, 26 Apr 2026 09:29:39 +1000 Subject: [PATCH 10/19] sites not users. --- src/wp-includes/admin-bar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index 50cb5a6cc5f61..5b82e640536fa 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -962,7 +962,7 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { __( 'Open command palette' ), ); /* - * Detect Apple OS via JavaScript for users behind a CDN blocking the UA header. + * Detect Apple OS via JavaScript for sites behind a CDN blocking the UA header. * * Running the script as the admin bar is rendered avoids a flash of incorrect content * for users with Apple OS when the UA header is blocked. It also prevents the need for From 7bd15d40c429cc1fd60c439096e6e91cd4fad0d8 Mon Sep 17 00:00:00 2001 From: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com> Date: Sun, 26 Apr 2026 09:37:41 +1000 Subject: [PATCH 11/19] Update src/wp-includes/admin-bar.php Co-authored-by: Weston Ruter --- src/wp-includes/admin-bar.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index 5b82e640536fa..09e6b460e34e2 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -969,16 +969,16 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { * wp-i18n to be loaded as a dependency as it is most likely not included on the front * end of a site. */ - $script = <<<'JS' - (( shortcutLabels ) => { + $function = <<<'JS' + ( shortcutLabels ) => { const isAppleOS = navigator.platform.startsWith("Mac") || navigator.platform === "iPhone" || navigator.platform === "iPad"; if ( ! isAppleOS ) { return; } document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' ).textContent = shortcutLabels.appleOS; - }) + } JS; - $script .= '(' . wp_json_encode( $shortcut_labels, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) . ');'; + $script = sprintf( '( %s )( %s );', $function, wp_json_encode( $shortcut_labels, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ); $script .= "\n//# sourceURL=wp_admin_bar_command_palette_menu"; $wp_admin_bar->add_node( array( From 895f727241418b12149311645e7bc3d9ec45de54 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Sun, 26 Apr 2026 09:39:37 +1000 Subject: [PATCH 12/19] Trolling? --- src/wp-includes/admin-bar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index 09e6b460e34e2..f7c539f40cd90 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -979,7 +979,7 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { } JS; $script = sprintf( '( %s )( %s );', $function, wp_json_encode( $shortcut_labels, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ); - $script .= "\n//# sourceURL=wp_admin_bar_command_palette_menu"; + $script .= "\n//# sourceURL=wp_admin_bar_command_palette_menu"; $wp_admin_bar->add_node( array( 'id' => 'command-palette', From 47cd7ef98ca2776cd310c3de5150c41070c20d1f Mon Sep 17 00:00:00 2001 From: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com> Date: Mon, 27 Apr 2026 07:50:50 +1000 Subject: [PATCH 13/19] Apply suggestion from @westonruter Co-authored-by: Weston Ruter --- src/wp-includes/admin-bar.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index f7c539f40cd90..31d407a73f720 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -971,11 +971,9 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { */ $function = <<<'JS' ( shortcutLabels ) => { - const isAppleOS = navigator.platform.startsWith("Mac") || navigator.platform === "iPhone" || navigator.platform === "iPad"; - if ( ! isAppleOS ) { - return; + if ( navigator.platform.startsWith("Mac") || navigator.platform === "iPhone" || navigator.platform === "iPad" ) { + document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' ).textContent = shortcutLabels.appleOS; } - document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' ).textContent = shortcutLabels.appleOS; } JS; $script = sprintf( '( %s )( %s );', $function, wp_json_encode( $shortcut_labels, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ); From dda24b63f2a19933cd8015003183d9b1013a3a80 Mon Sep 17 00:00:00 2001 From: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com> Date: Mon, 27 Apr 2026 07:57:44 +1000 Subject: [PATCH 14/19] Apply suggestion from @westonruter Co-authored-by: Weston Ruter --- src/wp-includes/admin-bar.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index 31d407a73f720..0a2e38d25344d 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -966,8 +966,7 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { * * Running the script as the admin bar is rendered avoids a flash of incorrect content * for users with Apple OS when the UA header is blocked. It also prevents the need for - * wp-i18n to be loaded as a dependency as it is most likely not included on the front - * end of a site. + * wp-i18n to be loaded as a dependency. */ $function = <<<'JS' ( shortcutLabels ) => { From 566148d767931e3ea82b5ffaec666b20eed8bbf1 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Mon, 27 Apr 2026 08:14:25 +1000 Subject: [PATCH 15/19] Easier to read, in my humble o --- src/wp-includes/admin-bar.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index 0a2e38d25344d..3d164e2e3f9d4 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -975,7 +975,11 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { } } JS; - $script = sprintf( '( %s )( %s );', $function, wp_json_encode( $shortcut_labels, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ); + $script = sprintf( + '( %s )( %s );', + $function, + wp_json_encode( $shortcut_labels, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) + ); $script .= "\n//# sourceURL=wp_admin_bar_command_palette_menu"; $wp_admin_bar->add_node( array( From 1e06c9f7009ae2ac229ae45091664aa66baf9784 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Mon, 27 Apr 2026 10:28:01 +1000 Subject: [PATCH 16/19] Only pass Apple OS shortcut label. Co-Authored-By: westonruter --- src/wp-includes/admin-bar.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index 3d164e2e3f9d4..cfcc297d53702 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -969,16 +969,16 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { * wp-i18n to be loaded as a dependency. */ $function = <<<'JS' - ( shortcutLabels ) => { + ( appleOSLabel ) => { if ( navigator.platform.startsWith("Mac") || navigator.platform === "iPhone" || navigator.platform === "iPad" ) { - document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' ).textContent = shortcutLabels.appleOS; + document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' ).textContent = appleOSLabel; } } JS; $script = sprintf( '( %s )( %s );', $function, - wp_json_encode( $shortcut_labels, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) + wp_json_encode( $shortcut_labels['appleOS'], JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ); $script .= "\n//# sourceURL=wp_admin_bar_command_palette_menu"; $wp_admin_bar->add_node( From fa9e82cbedc520875fd4c1ba50aa643f54e82af3 Mon Sep 17 00:00:00 2001 From: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com> Date: Mon, 27 Apr 2026 12:13:35 +1000 Subject: [PATCH 17/19] Update src/wp-includes/admin-bar.php Co-authored-by: Weston Ruter --- src/wp-includes/admin-bar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index cfcc297d53702..36bc2b313ef6c 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -989,7 +989,7 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { 'meta' => array( 'class' => 'hide-if-no-js', 'onclick' => 'wp.data.dispatch( "core/commands" ).open(); return false;', - 'html' => "", + 'html' => wp_get_inline_script_tag( $script ), ), ) ); From 108271b60acf2f2b69648e4c095e11bf245cba38 Mon Sep 17 00:00:00 2001 From: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com> Date: Mon, 27 Apr 2026 12:13:51 +1000 Subject: [PATCH 18/19] Update src/wp-includes/admin-bar.php Co-authored-by: Weston Ruter --- src/wp-includes/admin-bar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index 36bc2b313ef6c..dc52dc9d3e5d0 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -980,7 +980,7 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { $function, wp_json_encode( $shortcut_labels['appleOS'], JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ); - $script .= "\n//# sourceURL=wp_admin_bar_command_palette_menu"; + $script .= "\n//# sourceURL=" . esc_url_raw( __FUNCTION__ ); $wp_admin_bar->add_node( array( 'id' => 'command-palette', From 14add387c5ad4a8b0dd146b7dd7ba22c8a7e9e6f Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Mon, 27 Apr 2026 12:20:24 +1000 Subject: [PATCH 19/19] Trolling? Co-Authored-By: westonruter --- src/wp-includes/admin-bar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index dc52dc9d3e5d0..1e96ac794d8f2 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -980,7 +980,7 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { $function, wp_json_encode( $shortcut_labels['appleOS'], JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ); - $script .= "\n//# sourceURL=" . esc_url_raw( __FUNCTION__ ); + $script .= "\n//# sourceURL=" . rawurlencode( __FUNCTION__ ); $wp_admin_bar->add_node( array( 'id' => 'command-palette',