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.
Built from https://develop.svn.wordpress.org/trunk@35875


git-svn-id: http://core.svn.wordpress.org/trunk@35839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2015-12-11 22:49:41 +00:00
parent 1294c2bc3a
commit 24afea92c2
4 changed files with 10 additions and 3 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 )
{

View File

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