Skip to content

Conversation

@Adi-ty
Copy link
Contributor

@Adi-ty Adi-ty commented Aug 20, 2025

What?

Closes #71257

Moves the "Site Editor" navigation command from @wordpress/editor package to @wordpress/core-commands package to make it available on wp-admin dashboard pages.

Why?

The "Site Editor" command was only available in the post editor but missing from the admin dashboard Command Palette. The command existed in the @wordpress/editor package but needed to be moved to @wordpress/core-commands to be available across all admin contexts.

How?

  • Added Site Editor command: Only shown on block themes with template creation permissions.

Testing Instructions

  1. Use a block-based theme to test the site editor command.
  2. Navigate to any WordPress admin page.
  3. Open the Command Palette using Cmd or Ctrl + K.
  4. Type "Site Editor" → Should show "Site Editor" command.

screencast

Before After
Screen.Recording.2025-08-20.at.6.49.36.AM.mov
Screen.Recording.2025-08-20.at.6.48.57.AM.mov

…min dashboard

- Site Editor command: Only shown on block themes with template creation permissions
- Editor command: Always shown, opens new post creation
Fixes WordPress#71257
@Adi-ty Adi-ty marked this pull request as ready for review August 20, 2025 04:51
@github-actions
Copy link

github-actions bot commented Aug 20, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Adi-ty <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: ramonjd <[email protected]>
Co-authored-by: annezazu <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@t-hamano
Copy link
Contributor

Thanks for the PR! Let's confirm what the "Editor" command means first. See #71257 (comment)

@ramonjd
Copy link
Member

ramonjd commented Aug 21, 2025

Isn't there already an "Add post" which does same thing?

https://github.com/WordPress/gutenberg/blob/trunk/packages/core-commands/src/admin-navigation-commands.js#L93

Site editor is a nice addition.

@t-hamano
Copy link
Contributor

Isn't there already an "Add post" which does same thing?

Yes, I think just adding the "Site Editor" command should be enough. See: #71257 (comment)

@t-hamano
Copy link
Contributor

@Adi-ty As I commented here, we need to "move" the command instead of adding it. Otherwise, the command will be duplicated in the post editor:

image

Additionally, it would be good to delete the "Editor" command, and update the PR title and description.

@Adi-ty Adi-ty changed the title Core Commands: Add Site Editor and Editor commands to admin dashboard Core Commands: Add Site Editor command to admin dashboard Aug 21, 2025
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update!

I think the issue is intended to expose the existing "Open Site Editor" command to the admin page, so we don't need to change the label and icon. This means that we should use the label "Open Site Editor" and remove the icon.

Additionally, the command isn't necessary when a user is already in the site editor.

Please check the logic of the original implementation again:

if ( canCreateTemplate && isBlockBasedTheme ) {
const isSiteEditor = getPath( window.location.href )?.includes(
'site-editor.php'
);
if ( ! isSiteEditor ) {
commands.push( {
name: 'core/go-to-site-editor',
label: __( 'Open Site Editor' ),
callback: ( { close } ) => {
close();
document.location = 'site-editor.php';
},
} );
}
}

@Adi-ty Adi-ty changed the title Core Commands: Add Site Editor command to admin dashboard Core Commands: Move Site Editor command from @wordpress/editor package to @wordpress/core-commands Aug 21, 2025
@Adi-ty Adi-ty changed the title Core Commands: Move Site Editor command from @wordpress/editor package to @wordpress/core-commands Move Site Editor command from @wordpress/editor package to @wordpress/core-commands Aug 21, 2025
@Adi-ty
Copy link
Contributor Author

Adi-ty commented Aug 21, 2025

@t-hamano thanks for the review.

I've updated the PR to move the Site Editor command implementation from @wordpress/editor to @wordpress/core-commands as requested, rather than adding a duplicate.

@Adi-ty Adi-ty requested a review from t-hamano August 21, 2025 07:14
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

  • The command appears in all screens except for the site editor
  • The command doesn't appear if the user has no permission to access the site editor, or the active theme is not a block theme

Note: The failing CI is not related to this PR and has been fixed in trunk. See #71285

@t-hamano t-hamano merged commit bfd60c1 into WordPress:trunk Aug 21, 2025
68 of 69 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.6 milestone Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Command Palette: Add "Site Editor" command when in WP admin

3 participants