From 1aa22ca3c634b3f552a97c75dd6f0fc53bbba5e9 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 20 Aug 2024 17:50:16 +0000 Subject: [PATCH] Taxonomy: Correct the check for error messages in `wp-admin/edit-tag-form.php`. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Built from https://develop.svn.wordpress.org/trunk@58918 git-svn-id: http://core.svn.wordpress.org/trunk@58314 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-tag-form.php | 3 ++- wp-admin/edit-tags.php | 9 +++++---- wp-includes/version.php | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/wp-admin/edit-tag-form.php b/wp-admin/edit-tag-form.php index 0b59e36c84..b6da6c6687 100644 --- a/wp-admin/edit-tag-form.php +++ b/wp-admin/edit-tag-form.php @@ -72,7 +72,7 @@ do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?>

labels->edit_item; ?>

' . $message . '

'; @@ -83,6 +83,7 @@ if ( $message ) { esc_html( $tax->labels->back_to_items ) ); } + wp_admin_notice( $message, array( diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index db2a13fe82..a0a38d917d 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -321,8 +321,6 @@ require_once ABSPATH . 'wp-admin/admin-header.php'; // Also used by the Edit Tag form. require_once ABSPATH . 'wp-admin/includes/edit-tag-messages.php'; -$class = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'updated'; - if ( is_plugin_active( 'wpcat2tag-importer/wpcat2tag-importer.php' ) ) { $import_link = admin_url( 'admin.php?import=wpcat2tag' ); } else { @@ -349,7 +347,9 @@ if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
true, ) ); + $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message', 'error' ), $_SERVER['REQUEST_URI'] ); -endif; +} ?>
diff --git a/wp-includes/version.php b/wp-includes/version.php index 25ec4161cc..25674707ca 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.7-alpha-58917'; +$wp_version = '6.7-alpha-58918'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.