Make WordPress Core


Ignore:
Timestamp:
08/20/2024 05:48:07 PM (8 weeks ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-tags.php

    r58419 r58918  
    322322require_once ABSPATH . 'wp-admin/includes/edit-tag-messages.php';
    323323
    324 $class = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'updated';
    325 
    326324if ( is_plugin_active( 'wpcat2tag-importer/wpcat2tag-importer.php' ) ) {
    327325    $import_link = admin_url( 'admin.php?import=wpcat2tag' );
     
    350348
    351349<?php
    352 if ( $message ) :
     350$class = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'updated';
     351
     352if ( $message ) {
    353353    wp_admin_notice(
    354354        $message,
     
    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>
Note: See TracChangeset for help on using the changeset viewer.