Make WordPress Core

Ticket #26758: edit_tags_merged_changes.patch

File edit_tags_merged_changes.patch, 2.7 KB (added by chiragswadia, 10 years ago)

Added "Go back" link

  • 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 = 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; ?> <a href="<?php echo $original_referring_url; ?>"> Go Back</a></p></div>
     116        <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
     117endif; ?>
    66118<div id="ajax-response"></div>
    67119<?php
    68120/**
  • wp-admin/edit-tags.php

     
    148148        if ( 'post' != $post_type )
    149149                $location .= '&post_type=' . $post_type;
    150150
    151         if ( $referer = wp_get_original_referer() ) {
     151        if ( $referer = wp_get_referer() ) {
    152152                if ( false !== strpos( $referer, 'edit-tags.php' ) )
    153153                        $location = $referer;
    154154        }