Skip to content

Switching pages with command palette opens site editor even if user can't access it #62460

@dlh01

Description

@dlh01

Description

While editing a page using the post editor, I can open the command palette and search for a different page to edit, but when I select the page, it opens in the site editor even if I can't access that.

Step-by-step reproduction instructions

  1. Deny users the edit_theme_options capability (see snippet).
  2. Open a page in the post editor.
  3. Use the command palette to try to edit a different page.
  4. Get "Sorry, you are not allowed to access this page."

Screenshots, screen recording, code snippet

Deny the edit_theme_options capability with:

add_filter(
	'map_meta_cap',
	function ( $caps, $cap ) {
		if ( 'edit_theme_options' === $cap ) {
			$caps = [ 'do_not_allow' ];
		}

		return $caps;
	},
	10,
	2
);

Environment info

  • WordPress 6.6 beta 1
  • Gutenberg plugin deactivated
  • Twenty Twenty-Four theme

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions