Make WordPress Core

Ticket #26758: 26758-040714-2.patch

File 26758-040714-2.patch, 3.1 KB (added by rhyswynne, 10 years ago)

Reverts "Go To Tags" back to "Go Back" on 26758-040714.patch

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

     
    4848         */
    4949        do_action( 'edit_tag_form_pre', $tag );
    5050}
     51// We are storing it to show a go back link once term is updated
     52$original_referring_url = esc_url( remove_query_arg( array( 'message','tag_ID','action','message' ), wp_get_referer() ) );
     53
     54$messages = array();
     55$messages['_item'] = array(
     56        0 => '', // Unused. Messages start at index 1.
     57        1 => __( 'Item added.' ),
     58        2 => __( 'Item deleted.' ),
     59        3 => __( 'Item updated.' ),
     60        4 => __( 'Item not added.' ),
     61        5 => __( 'Item not updated.' ),
     62        6 => __( 'Items deleted.' )
     63);
     64$messages['category'] = array(
     65        0 => '', // Unused. Messages start at index 1.
     66        1 => __( 'Category added.' ),
     67        2 => __( 'Category deleted.' ),
     68        3 => __( 'Category updated.' ),
     69        4 => __( 'Category not added.' ),
     70        5 => __( 'Category not updated.' ),
     71        6 => __( 'Categories deleted.' )
     72);
     73$messages['post_tag'] = array(
     74        0 => '', // Unused. Messages start at index 1.
     75        1 => __( 'Tag added.' ),
     76        2 => __( 'Tag deleted.' ),
     77        3 => __( 'Tag updated.' ),
     78        4 => __( 'Tag not added.' ),
     79        5 => __( 'Tag not updated.' ),
     80        6 => __( 'Tags deleted.' )
     81);
     82
     83/**
     84 * Filter the messages displayed when a tag is updated.
     85 *
     86 * @since 3.7.0
     87 *
     88 * @param array $messages The messages to be displayed.
     89 */
     90$messages = apply_filters( 'term_updated_messages', $messages );
     91
     92$message = false;
     93if ( isset( $_REQUEST['message'] ) && ( $msg = (int) $_REQUEST['message'] ) ) {
     94                if ( isset( $messages[ $taxonomy ][ $msg ] ) )
     95                                $message = $messages[ $taxonomy ][ $msg ];
     96                elseif ( ! isset( $messages[ $taxonomy ] ) && isset( $messages['_item'][ $msg ] ) )
     97                                $message = $messages['_item'][ $msg ];
     98}
    5199/**
    52100 * Fires before the Edit Term form for all taxonomies.
    53101 *
     
    63111
    64112<div class="wrap">
    65113<h2><?php echo $tax->labels->edit_item; ?></h2>
     114<?php if ( $message ) : ?>
     115        <div id="message" class="updated"><p><?php echo $message; ?>
     116        <?php if ( $original_referring_url ) { ?>
     117                <a href="<?php echo $original_referring_url; ?>"><?php _e('Go Back'); ?></a>
     118        <?php } ?>
     119        </p></div>
     120        <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
     121endif; ?>
    66122<div id="ajax-response"></div>
    67123<?php
    68124/**
  • wp-admin/edit-tags.php

     
    5252        if ( 'post' != $post_type )
    5353                $location .= '&post_type=' . $post_type;
    5454
    55         if ( $referer = wp_get_original_referer() ) {
     55        if ( $referer = wp_get_referer() ) {
    5656                if ( false !== strpos( $referer, 'edit-tags.php' ) )
    5757                        $location = $referer;
    5858        }
     
    143143        if ( 'post' != $post_type )
    144144                $location .= '&post_type=' . $post_type;
    145145
    146         if ( $referer = wp_get_original_referer() ) {
     146        if ( $referer = wp_get_referer() ) {
    147147                if ( false !== strpos( $referer, 'edit-tags.php' ) )
    148148                        $location = $referer;
    149149        }