Skip to content

Commit 6189d05

Browse files
Taxonomy: Correct the check for error messages in wp-admin/edit-tag-form.php.
Instead of checking for a specific message, e.g. “Item not updated”, the `$_REQUEST['error']` variable is now checked. This allows for custom messages added via the `term_updated_messages` filter to be considered an error when appropriate, and displayed with the correct CSS class. This also brings consistency with a similar check in `wp-admin/edit-tags.php`. Follow-up to [31823], [44663]. Props xipasduarte. Fixes #61896. git-svn-id: https://develop.svn.wordpress.org/trunk@58918 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 605c056 commit 6189d05

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/wp-admin/edit-tag-form.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
<h1><?php echo $tax->labels->edit_item; ?></h1>
7373

7474
<?php
75-
$class = ( isset( $msg ) && 5 === $msg ) ? 'error' : 'success';
75+
$class = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'success';
7676

7777
if ( $message ) {
7878
$message = '<p><strong>' . $message . '</strong></p>';
@@ -83,6 +83,7 @@
8383
esc_html( $tax->labels->back_to_items )
8484
);
8585
}
86+
8687
wp_admin_notice(
8788
$message,
8889
array(

src/wp-admin/edit-tags.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,6 @@
321321
// Also used by the Edit Tag form.
322322
require_once ABSPATH . 'wp-admin/includes/edit-tag-messages.php';
323323

324-
$class = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'updated';
325-
326324
if ( is_plugin_active( 'wpcat2tag-importer/wpcat2tag-importer.php' ) ) {
327325
$import_link = admin_url( 'admin.php?import=wpcat2tag' );
328326
} else {
@@ -349,7 +347,9 @@
349347
<hr class="wp-header-end">
350348

351349
<?php
352-
if ( $message ) :
350+
$class = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'updated';
351+
352+
if ( $message ) {
353353
wp_admin_notice(
354354
$message,
355355
array(
@@ -358,8 +358,9 @@
358358
'dismissible' => true,
359359
)
360360
);
361+
361362
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message', 'error' ), $_SERVER['REQUEST_URI'] );
362-
endif;
363+
}
363364
?>
364365
<div id="ajax-response"></div>
365366

0 commit comments

Comments
 (0)