Editor: Grant only admins access to the "Navigation Menus" UI for block and non-block themes.

Restricts and grants access to only admin roles for the Navigation Menu UI screen, i.e. either directly through the URL wp-admin/edit.php?post_type=wp_navigation or via the Navigation block's "Manage menu" option (in the block's toolbar).

It resolves 2 issues:

- For non-block themes, fixes the issue where admins could not access the UI.
- For block themes, restricts access to only admin roles, i.e. non-admins no longer have access to the UI.

Non-admins will receive the "Sorry, you are not allowed to edit posts in this post type" error message.

Follow-up [52069], [52145], [52330], [52400].

Props ironprogrammer, costdev, noisysocks, talldanwp, hellofromTonya, manfcarlo, pyrobd.
Fixes #54889.
Built from https://develop.svn.wordpress.org/trunk@52755


git-svn-id: http://core.svn.wordpress.org/trunk@52344 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
hellofromTonya 2022-02-17 15:11:01 +00:00
parent f42e80b077
commit 9ac43b6ade
2 changed files with 3 additions and 2 deletions

View File

@ -503,7 +503,7 @@ function create_initial_post_types() {
'public' => false,
'_builtin' => true, /* internal use only. don't use this when registering your own post type. */
'has_archive' => false,
'show_ui' => wp_is_block_theme(),
'show_ui' => true,
'show_in_menu' => false,
'show_in_admin_bar' => false,
'show_in_rest' => true,
@ -520,6 +520,7 @@ function create_initial_post_types() {
'delete_others_posts' => 'edit_theme_options',
'edit_private_posts' => 'edit_theme_options',
'edit_published_posts' => 'edit_theme_options',
'edit_posts' => 'edit_theme_options',
),
'rest_base' => 'navigation',
'rest_controller_class' => 'WP_REST_Posts_Controller',

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-alpha-52754';
$wp_version = '6.0-alpha-52755';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.