WordPress.org

Make WordPress Core

Ticket #31241: 31241.4.diff

File 31241.4.diff, 1.4 KB (added by rahulbhangale, 5 years ago)

Filtering of messages can be done by sending the message type with url parameter.

  • wp-admin/edit-tags.php

    diff -rupN -x '.*' contributeold/wp-admin/edit-tags.php contribute/wp-admin/edit-tags.php
    old new case 'add-tag': 
    6262        if ( $ret && !is_wp_error( $ret ) )
    6363                $location = add_query_arg( 'message', 1, $location );
    6464        else
    65                 $location = add_query_arg( 'message', 4, $location );
     65                $location = add_query_arg( array('error' => true , 'message' => 4) , $location );
    6666
    6767        break;
    6868
    case 'editedtag': 
    153153        if ( $ret && !is_wp_error( $ret ) )
    154154                $location = add_query_arg( 'message', 3, $location );
    155155        else
    156                 $location = add_query_arg( 'message', 5, $location );
     156                $location = add_query_arg( array('error' => true ,'message' => 5) , $location );
    157157        break;
    158158}
    159159
    if ( !empty($_REQUEST['s']) ) 
    302302        printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?>
    303303</h2>
    304304
    305 <?php if ( $message ) : ?>
     305<?php if ( $message && isset($_REQUEST['error'])) : ?>
     306<div id="message" class="error"><p><?php echo $message; ?></p></div>
     307<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
     308elseif( $message ) :
     309?>
    306310<div id="message" class="updated"><p><?php echo $message; ?></p></div>
    307311<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
    308312endif; ?>