WordPress.org

Make WordPress Core

Ticket #18714: 18714.diff

File 18714.diff, 2.6 KB (added by wonderboymusic, 5 years ago)
  • wp-admin/edit-tags.php

    diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php
    index 8375202..37a551f 100644
    a b require_once ('admin-header.php'); 
    252252if ( !current_user_can($tax->cap->edit_terms) )
    253253        wp_die( __('You are not allowed to edit this item.') );
    254254
    255 $messages[1] = __('Item added.');
    256 $messages[2] = __('Item deleted.');
    257 $messages[3] = __('Item updated.');
    258 $messages[4] = __('Item not added.');
    259 $messages[5] = __('Item not updated.');
    260 $messages[6] = __('Items deleted.');
     255$messages = array();
     256$messages['_item'] = array(
     257        0 => '', // Unused. Messages start at index 1.
     258        1 => __( 'Item added.' ),
     259        2 => __( 'Item deleted.' ),
     260        3 => __( 'Item updated.' ),
     261        4 => __( 'Item not added.' ),
     262        5 => __( 'Item not updated.' ),
     263        6 => __( 'Items deleted.' )
     264);
     265$messages['category'] = array(
     266        0 => '', // Unused. Messages start at index 1.
     267        1 => __( 'Category added.' ),
     268        2 => __( 'Category deleted.' ),
     269        3 => __( 'Category updated.' ),
     270        4 => __( 'Category not added.' ),
     271        5 => __( 'Category not updated.' ),
     272        6 => __( 'Categories deleted.' )
     273);
     274$messages['link_category'] = array(
     275        0 => '', // Unused. Messages start at index 1.
     276        1 => __( 'Category added.' ),
     277        2 => __( 'Category deleted.' ),
     278        3 => __( 'Category updated.' ),
     279        4 => __( 'Category not added.' ),
     280        5 => __( 'Category not updated.' ),
     281        6 => __( 'Categories deleted.' )
     282);
     283$messages['post_tag'] = array(
     284        0 => '', // Unused. Messages start at index 1.
     285        1 => __( 'Tag added.' ),
     286        2 => __( 'Tag deleted.' ),
     287        3 => __( 'Tag updated.' ),
     288        4 => __( 'Tag not added.' ),
     289        5 => __( 'Tag not updated.' ),
     290        6 => __( 'Tags deleted.' )
     291);
     292
     293$messages = apply_filters( 'term_updated_messages', $messages );
     294
     295$message = false;
     296if ( isset( $_REQUEST['message'] ) && ( $msg = (int) $_REQUEST['message'] ) ) {
     297        if ( isset( $messages[$taxonomy][$msg] ) )
     298                $message = $messages[$taxonomy][$msg];
     299        elseif ( ! isset( $messages[$taxonomy] ) && isset( $messages['_item'][$msg] ) )
     300                $message = $messages['_item'][$msg];
     301}
    261302
    262303?>
    263304
    if ( !empty($_REQUEST['s']) ) 
    268309        printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?>
    269310</h2>
    270311
    271 <?php if ( isset($_REQUEST['message']) && ( $msg = (int) $_REQUEST['message'] ) ) : ?>
    272 <div id="message" class="updated"><p><?php echo $messages[$msg]; ?></p></div>
     312<?php if ( $message ) : ?>
     313<div id="message" class="updated"><p><?php echo $message; ?></p></div>
    273314<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
    274315endif; ?>
    275316<div id="ajax-response"></div>