From 4dfb95179aa70ed014315d03342779044e4406ff Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Fri, 11 Dec 2015 22:48:49 +0000 Subject: [PATCH] When editing terms, properly display an admin `notice-warning` when `tag_ID` is empty. Also, avoids two related PHP notices when empty or not set (and thus the global `$tag` is a WP_Error object). Fixes: #34515. git-svn-id: https://develop.svn.wordpress.org/trunk@35875 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/edit-tag-form.php | 5 ++++- src/wp-admin/edit-tags.php | 4 ++++ src/wp-includes/admin-bar.php | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/edit-tag-form.php b/src/wp-admin/edit-tag-form.php index 8b5c61b164..b8d23402cd 100644 --- a/src/wp-admin/edit-tag-form.php +++ b/src/wp-admin/edit-tag-form.php @@ -11,7 +11,10 @@ if ( !defined('ABSPATH') ) die('-1'); if ( empty($tag_ID) ) { ?> -

+
+

labels->edit_item; ?>

+

+
labels->edit_item; + if ( ! isset( $_REQUEST['tag_ID'] ) ) { + break; + } + $tag_ID = (int) $_REQUEST['tag_ID']; $tag = get_term( $tag_ID, $taxonomy, OBJECT, 'edit' ); diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index 2bf56a8630..ac117f7a52 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -574,7 +574,7 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) { ) ); } } elseif ( 'edit-tags' == $current_screen->base - && isset( $tag ) && is_object( $tag ) + && isset( $tag ) && is_object( $tag ) && ! is_wp_error( $tag ) && ( $tax = get_taxonomy( $tag->taxonomy ) ) && $tax->public ) {