From 44c051923ef2ca71c9eec4540fefcd40d09a3a24 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 13 Oct 2011 18:55:40 +0000 Subject: [PATCH] Avoid notices when viewing non-existent taxonomy. Props ocean90, johnbillion. fixes #18716 git-svn-id: https://develop.svn.wordpress.org/trunk@18966 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/edit-tags.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index eb44b5f137..3e03ca8ee7 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -8,8 +8,22 @@ /** WordPress Administration Bootstrap */ require_once('./admin.php'); -$tax = get_taxonomy( $taxnow ); -if ( !current_user_can( $tax->cap->manage_terms ) ) + +if ( ! isset( $_GET['taxonomy'] ) ) + $taxonomy = 'post_tag'; +elseif ( in_array( $_GET['taxonomy'], get_taxonomies( array('show_ui' => true ) ) ) ) + $taxonomy = sanitize_key( $_GET['taxonomy'] ); +else + wp_die( __( 'Invalid taxonomy' ) ); + +$_GET['taxonomy'] = $taxonomy; + +$tax = get_taxonomy( $taxonomy ); + +if ( ! $tax ) + wp_die( __( 'Invalid taxonomy' ) ); + +if ( ! current_user_can( $tax->cap->manage_terms ) ) wp_die( __( 'Cheatin’ uh?' ) ); $wp_list_table = _get_list_table('WP_Terms_List_Table');