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
This commit is contained in:
Andrea Fercia 2015-12-11 22:48:49 +00:00
parent 5a445d7515
commit 4dfb95179a
3 changed files with 9 additions and 2 deletions

View File

@ -11,7 +11,10 @@ if ( !defined('ABSPATH') )
die('-1');
if ( empty($tag_ID) ) { ?>
<div id="message" class="updated notice is-dismissible"><p><strong><?php _e( 'You did not select an item for editing.' ); ?></strong></p></div>
<div class="wrap">
<h1><?php echo $tax->labels->edit_item; ?></h1>
<div id="message" class="notice notice-warning"><p><strong><?php _e( 'You did not select an item for editing.' ); ?></strong></p></div>
</div>
<?php
return;
}

View File

@ -152,6 +152,10 @@ case 'bulk-delete':
case 'edit':
$title = $tax->labels->edit_item;
if ( ! isset( $_REQUEST['tag_ID'] ) ) {
break;
}
$tag_ID = (int) $_REQUEST['tag_ID'];
$tag = get_term( $tag_ID, $taxonomy, OBJECT, 'edit' );

View File

@ -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 )
{