Skip to content

Commit 6af5ed7

Browse files
t-hamanontsekouras
authored andcommitted
Command Palette: Disable site editor navigation commands on Network Admin (#72572)
Co-authored-by: t-hamano <[email protected]> Co-authored-by: ntsekouras <[email protected]>
1 parent e985e93 commit 6af5ed7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/core-commands/src/site-editor-navigation-commands.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ const getNavigationCommandLoaderPerPostType = ( postType ) =>
101101
);
102102

103103
const commands = useMemo( () => {
104+
if ( window.location.pathname.startsWith( '/wp-admin/network/' ) ) {
105+
return [];
106+
}
107+
104108
return ( records ?? [] ).map( ( record ) => {
105109
const command = {
106110
name: postType + '-' + record.id,
@@ -200,6 +204,10 @@ const getNavigationCommandLoaderPerTemplate = ( templateType ) =>
200204
}, [ records, search ] );
201205

202206
const commands = useMemo( () => {
207+
if ( window.location.pathname.startsWith( '/wp-admin/network/' ) ) {
208+
return [];
209+
}
210+
203211
if (
204212
! canCreateTemplate ||
205213
( ! isBlockBasedTheme && ! templateType === 'wp_template_part' )
@@ -297,6 +305,10 @@ const getSiteEditorBasicNavigationCommands = () =>
297305
};
298306
}, [] );
299307
const commands = useMemo( () => {
308+
if ( window.location.pathname.startsWith( '/wp-admin/network/' ) ) {
309+
return [];
310+
}
311+
300312
const result = [];
301313

302314
if ( canCreateTemplate && isBlockBasedTheme ) {
@@ -422,6 +434,10 @@ const getGlobalStylesOpenCssCommands = () =>
422434
}, [] );
423435

424436
const commands = useMemo( () => {
437+
if ( window.location.pathname.includes( '/wp-admin/network/' ) ) {
438+
return [];
439+
}
440+
425441
if ( ! canEditCSS ) {
426442
return [];
427443
}

0 commit comments

Comments
 (0)