Make WordPress Core


Ignore:
Timestamp:
09/15/2015 03:58:04 PM (9 years ago)
Author:
wonderboymusic
Message:

Don't redirect to the Term list table after submitting the form on the Edit Term page.

Props chiragswadia, UmeshSingla, rhyswynne, afercia.
Fixes #17455.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-terms-list-table.php

    r34059 r34202  
    360360
    361361        $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' );
    362         $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) );
    363 
    364         $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $name ) ) . '">' . $name . '</a></strong><br />';
     362
     363        $uri = ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ? wp_get_referer() : $_SERVER['REQUEST_URI'];
     364
     365        $edit_link = add_query_arg(
     366            'wp_http_referer',
     367            urlencode( wp_unslash( $uri ) ),
     368            get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type )
     369        );
     370
     371        $out = '<strong><a class="row-title" href="' . esc_url( $edit_link ) . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $name ) ) . '">' . $name . '</a></strong><br />';
    365372
    366373        $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
     
    406413        $default_term = get_option( 'default_' . $taxonomy );
    407414
    408         $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) );
     415        $uri = ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ? wp_get_referer() : $_SERVER['REQUEST_URI'];
     416
     417        $edit_link = add_query_arg(
     418            'wp_http_referer',
     419            urlencode( wp_unslash( $uri ) ),
     420            get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type )
     421        );
    409422
    410423        $actions = array();
    411424        if ( current_user_can( $tax->cap->edit_terms ) ) {
    412             $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
     425            $actions['edit'] = '<a href="' . esc_url( $edit_link ) . '">' . __( 'Edit' ) . '</a>';
    413426            $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick&nbsp;Edit' ) . '</a>';
    414427        }
Note: See TracChangeset for help on using the changeset viewer.