Make WordPress Core

Changeset 52756


Ignore:
Timestamp:
02/17/2022 03:44:02 PM (3 years ago)
Author:
hellofromTonya
Message:

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.
Merges [52755] to the 5.9 branch.
Fixes #54889.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.9/src/wp-includes/post.php

    r52712 r52756  
    504504            '_builtin'              => true, /* internal use only. don't use this when registering your own post type. */
    505505            'has_archive'           => false,
    506             'show_ui'               => wp_is_block_theme(),
     506            'show_ui'               => true,
    507507            'show_in_menu'          => false,
    508508            'show_in_admin_bar'     => false,
     
    521521                'edit_private_posts'     => 'edit_theme_options',
    522522                'edit_published_posts'   => 'edit_theme_options',
     523                'edit_posts'             => 'edit_theme_options',
    523524            ),
    524525            'rest_base'             => 'navigation',
Note: See TracChangeset for help on using the changeset viewer.