Ticket #34988: 34988.diff
File 34988.diff, 5.8 KB (added by , 9 years ago) |
---|
-
src/wp-admin/edit-tag-form.php
diff --git src/wp-admin/edit-tag-form.php src/wp-admin/edit-tag-form.php index b8d2340..ea92a2d 100644
7 7 */ 8 8 9 9 // don't load directly 10 if ( !defined('ABSPATH') ) 11 die('-1'); 12 13 if ( empty($tag_ID) ) { ?> 14 <div class="wrap"> 15 <h1><?php echo $tax->labels->edit_item; ?></h1> 16 <div id="message" class="notice notice-warning"><p><strong><?php _e( 'You did not select an item for editing.' ); ?></strong></p></div> 17 </div> 18 <?php 19 return; 10 if ( ! defined( 'ABSPATH' ) ) { 11 die( '-1' ); 20 12 } 21 13 22 14 // Back compat hooks … … if ( 'category' == $taxonomy ) { 57 49 */ 58 50 wp_reset_vars( array( 'wp_http_referer' ) ); 59 51 60 $wp_http_referer = remove_query_arg( array( 'action', 'message', 't ag_ID' ), $wp_http_referer );52 $wp_http_referer = remove_query_arg( array( 'action', 'message', 'term_id' ), $wp_http_referer ); 61 53 62 54 /** Also used by Edit Tags */ 63 55 require_once( ABSPATH . 'wp-admin/includes/edit-tag-messages.php' ); … … do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?> 103 95 */ 104 96 do_action( "{$taxonomy}_term_edit_form_tag" ); 105 97 ?>> 106 <input type="hidden" name="action" value="editedtag" /> 107 <input type="hidden" name="tag_ID" value="<?php echo esc_attr($tag->term_id) ?>" /> 108 <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy) ?>" /> 109 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_' . $tag_ID); ?> 98 <input type="hidden" name="action" value="editedtag"/> 99 <input type="hidden" name="tag_ID" value="<?php echo esc_attr( $term_id ) ?>"/> 100 <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ) ?>"/> 101 <?php 102 wp_original_referer_field( true, 'previous' ); 103 wp_nonce_field( 'update-tag_' . $term_id ); 104 ?> 110 105 <table class="form-table"> 111 106 <tr class="form-field form-required term-name-wrap"> 112 107 <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th> -
src/wp-admin/edit-tags.php
diff --git src/wp-admin/edit-tags.php src/wp-admin/edit-tags.php index 713c8b9..b953da6 100644
case 'bulk-delete': 150 150 break; 151 151 152 152 case 'edit': 153 $title = $tax->labels->edit_item;154 155 153 if ( ! isset( $_REQUEST['tag_ID'] ) ) { 156 154 break; 157 155 } 158 156 159 $tag_ID = (int) $_REQUEST['tag_ID']; 157 $term_id = (int) $_REQUEST['tag_ID']; 158 $term = get_term( $term_id ); 160 159 161 $tag = get_term( $tag_ID, $taxonomy, OBJECT, 'edit' ); 162 if ( ! $tag ) 160 if ( ! $term instanceof WP_Term ) { 163 161 wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); 164 require_once( ABSPATH . 'wp-admin/admin-header.php' ); 165 include( ABSPATH . 'wp-admin/edit-tag-form.php' ); 166 include( ABSPATH . 'wp-admin/admin-footer.php' ); 162 } 167 163 164 wp_redirect( esc_url_raw( get_edit_term_link( $term_id, $taxonomy, $post_type ) ) ); 168 165 exit; 169 166 170 167 case 'editedtag': -
new file src/wp-admin/term.php
diff --git src/wp-admin/term.php src/wp-admin/term.php new file mode 100644 index 0000000..76990f7
- + 1 <?php 2 /** 3 * Edit Term Administration Screen. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 /** WordPress Administration Bootstrap */ 10 require_once( dirname( __FILE__ ) . '/admin.php' ); 11 12 if ( empty( $_REQUEST['term_id'] ) ) { 13 $sendback = admin_url( 'edit-tags.php' ); 14 if ( ! empty( $taxnow ) ) { 15 $sendback = add_query_arg( array( 'taxonomy' => $taxnow ), $sendback ); 16 } 17 wp_redirect( esc_url( $sendback ) ); 18 exit; 19 } 20 21 $term_id = absint( $_REQUEST['term_id'] ); 22 $tag = get_term( $term_id, $taxnow, OBJECT, 'edit' ); 23 24 if ( ! $tag instanceof WP_Term ) { 25 wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); 26 } 27 28 $tax = get_taxonomy( $tag->taxonomy ); 29 $taxonomy = $tax->name; 30 $title = $tax->labels->edit_item; 31 32 if ( ! in_array( $taxonomy, get_taxonomies( array( 'show_ui' => true ) ) ) || 33 ! current_user_can( $tax->cap->manage_terms ) 34 ) { 35 wp_die( 36 '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . 37 '<p>' . __( 'You are not allowed to manage this item.' ) . '</p>', 38 403 39 ); 40 } 41 42 $post_type = get_current_screen()->post_type; 43 44 // Default to the first object_type associated with the taxonomy if no post type was passed. 45 if ( empty( $post_type ) ) { 46 $post_type = reset( $tax->object_type ); 47 } 48 49 if ( 'post' != $post_type ) { 50 $parent_file = ( 'attachment' == $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type"; 51 $submenu_file = "edit-tags.php?taxonomy=$taxonomy&post_type=$post_type"; 52 } elseif ( 'link_category' == $taxonomy ) { 53 $parent_file = 'link-manager.php'; 54 $submenu_file = 'edit-tags.php?taxonomy=link_category'; 55 } else { 56 $parent_file = 'edit.php'; 57 $submenu_file = "edit-tags.php?taxonomy=$taxonomy"; 58 } 59 60 get_current_screen()->set_screen_reader_content( array( 61 'heading_pagination' => $tax->labels->items_list_navigation, 62 'heading_list' => $tax->labels->items_list, 63 ) ); 64 65 require_once( ABSPATH . 'wp-admin/admin-header.php' ); 66 include( ABSPATH . 'wp-admin/edit-tag-form.php' ); 67 include( ABSPATH . 'wp-admin/admin-footer.php' ); -
src/wp-includes/link-template.php
diff --git src/wp-includes/link-template.php src/wp-includes/link-template.php index 4176db1..2351f7c 100644
function get_edit_term_link( $term_id, $taxonomy, $object_type = '' ) { 926 926 } 927 927 928 928 $args = array( 929 'action' => 'edit',930 929 'taxonomy' => $taxonomy, 931 't ag_ID'=> $term->term_id,930 'term_id' => $term->term_id, 932 931 ); 933 932 934 933 if ( $object_type ) { … … function get_edit_term_link( $term_id, $taxonomy, $object_type = '' ) { 938 937 } 939 938 940 939 if ( $tax->show_ui ) { 941 $location = add_query_arg( $args, admin_url( ' edit-tags.php' ) );940 $location = add_query_arg( $args, admin_url( 'term.php' ) ); 942 941 } else { 943 942 $location = ''; 944 943 }