Remove the ability to view the term editing screen for taxonomies with show_ui
set to false
. It is unexpected and unintended behaviour that this is allowed.
If your plugin or site does rely on this behaviour, the arguments that are passed to `register_taxonomy()` should be altered so that `show_ui` is `true`, and arguments such as `show_in_menu` and `show_in_nav_menus` are false. Fixes #33938 git-svn-id: https://develop.svn.wordpress.org/trunk@34359 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
dc7d968b19
commit
ce126c10c0
@ -17,6 +17,10 @@ $tax = get_taxonomy( $taxnow );
|
||||
if ( ! $tax )
|
||||
wp_die( __( 'Invalid taxonomy' ) );
|
||||
|
||||
if ( ! in_array( $tax->name, get_taxonomies( array( 'show_ui' => true ) ) ) ) {
|
||||
wp_die( __( 'You are not allowed to manage these items.' ) );
|
||||
}
|
||||
|
||||
if ( ! current_user_can( $tax->cap->manage_terms ) ) {
|
||||
wp_die(
|
||||
'<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' .
|
||||
|
@ -281,7 +281,7 @@ function is_taxonomy_hierarchical($taxonomy) {
|
||||
* - public - If the taxonomy should be publicly queryable.
|
||||
* * Defaults to true.
|
||||
* - hierarchical - Whether the taxonomy is hierarchical (e.g. category). Defaults to false.
|
||||
* - show_ui - Whether to generate a default UI for managing this taxonomy in the admin.
|
||||
* - show_ui - Whether to generate and allow a UI for managing terms in this taxonomy in the admin.
|
||||
* * If not set, the default is inherited from public.
|
||||
* - show_in_menu - Whether to show the taxonomy in the admin menu.
|
||||
* * If true, the taxonomy is shown as a submenu of the object type menu.
|
||||
@ -323,6 +323,7 @@ function is_taxonomy_hierarchical($taxonomy) {
|
||||
*
|
||||
* @since 2.3.0
|
||||
* @since 4.2.0 Introduced `show_in_quick_edit` argument.
|
||||
* @since 4.4.0 The `show_ui` argument is now enforced on the term editing screen.
|
||||
*
|
||||
* @global array $wp_taxonomies Registered taxonomies.
|
||||
* @global WP $wp WP instance.
|
||||
|
Loading…
Reference in New Issue
Block a user