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

Built from https://develop.svn.wordpress.org/trunk@34359


git-svn-id: http://core.svn.wordpress.org/trunk@34323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2015-09-20 17:11:25 +00:00
parent 86bb996446
commit 970752a351
3 changed files with 7 additions and 2 deletions

View File

@ -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&#8217; uh?' ) . '</h1>' .

View File

@ -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.

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34358';
$wp_version = '4.4-alpha-34359';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.