From c28bd6af031c194a6d75e34c144107f879744506 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 12 Oct 2011 20:30:50 +0000 Subject: [PATCH] Die when attempting to edit non-existent term. Props johnbillion. fixes #18718 git-svn-id: http://svn.automattic.com/wordpress/trunk@18954 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-tags.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index b0e9fc55e4..eb44b5f137 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -113,10 +113,12 @@ break; case 'edit': $title = $tax->labels->edit_item; - require_once ( 'admin-header.php' ); $tag_ID = (int) $_REQUEST['tag_ID']; $tag = get_term( $tag_ID, $taxonomy, OBJECT, 'edit' ); + if ( ! $tag ) + wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); + require_once ( 'admin-header.php' ); include( './edit-tag-form.php' ); break; @@ -127,6 +129,10 @@ case 'editedtag': if ( !current_user_can( $tax->cap->edit_terms ) ) wp_die( __( 'Cheatin’ uh?' ) ); + + $tag = get_term( $tag_ID, $taxonomy ); + if ( ! $tag ) + wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); $ret = wp_update_term( $tag_ID, $taxonomy, $_POST );