diff --git a/wp-admin/edit-tag-form.php b/wp-admin/edit-tag-form.php index b8d23402cd..ea92a2d16a 100644 --- a/wp-admin/edit-tag-form.php +++ b/wp-admin/edit-tag-form.php @@ -7,16 +7,8 @@ */ // don't load directly -if ( !defined('ABSPATH') ) - die('-1'); - -if ( empty($tag_ID) ) { ?> -
-

labels->edit_item; ?>

-

-
- */ do_action( "{$taxonomy}_term_edit_form_tag" ); ?>> - - - - + + + + diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index 713c8b9472..b953da683a 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -150,21 +150,18 @@ case 'bulk-delete': break; case 'edit': - $title = $tax->labels->edit_item; - if ( ! isset( $_REQUEST['tag_ID'] ) ) { break; } - $tag_ID = (int) $_REQUEST['tag_ID']; + $term_id = (int) $_REQUEST['tag_ID']; + $term = get_term( $term_id ); - $tag = get_term( $tag_ID, $taxonomy, OBJECT, 'edit' ); - if ( ! $tag ) + if ( ! $term instanceof WP_Term ) { wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); - require_once( ABSPATH . 'wp-admin/admin-header.php' ); - include( ABSPATH . 'wp-admin/edit-tag-form.php' ); - include( ABSPATH . 'wp-admin/admin-footer.php' ); + } + wp_redirect( esc_url_raw( get_edit_term_link( $term_id, $taxonomy, $post_type ) ) ); exit; case 'editedtag': diff --git a/wp-admin/term.php b/wp-admin/term.php new file mode 100644 index 0000000000..76990f761e --- /dev/null +++ b/wp-admin/term.php @@ -0,0 +1,67 @@ + $taxnow ), $sendback ); + } + wp_redirect( esc_url( $sendback ) ); + exit; +} + +$term_id = absint( $_REQUEST['term_id'] ); +$tag = get_term( $term_id, $taxnow, OBJECT, 'edit' ); + +if ( ! $tag instanceof WP_Term ) { + wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); +} + +$tax = get_taxonomy( $tag->taxonomy ); +$taxonomy = $tax->name; +$title = $tax->labels->edit_item; + +if ( ! in_array( $taxonomy, get_taxonomies( array( 'show_ui' => true ) ) ) || + ! current_user_can( $tax->cap->manage_terms ) +) { + wp_die( + '

' . __( 'Cheatin’ uh?' ) . '

' . + '

' . __( 'You are not allowed to manage this item.' ) . '

', + 403 + ); +} + +$post_type = get_current_screen()->post_type; + +// Default to the first object_type associated with the taxonomy if no post type was passed. +if ( empty( $post_type ) ) { + $post_type = reset( $tax->object_type ); +} + +if ( 'post' != $post_type ) { + $parent_file = ( 'attachment' == $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type"; + $submenu_file = "edit-tags.php?taxonomy=$taxonomy&post_type=$post_type"; +} elseif ( 'link_category' == $taxonomy ) { + $parent_file = 'link-manager.php'; + $submenu_file = 'edit-tags.php?taxonomy=link_category'; +} else { + $parent_file = 'edit.php'; + $submenu_file = "edit-tags.php?taxonomy=$taxonomy"; +} + +get_current_screen()->set_screen_reader_content( array( + 'heading_pagination' => $tax->labels->items_list_navigation, + 'heading_list' => $tax->labels->items_list, +) ); + +require_once( ABSPATH . 'wp-admin/admin-header.php' ); +include( ABSPATH . 'wp-admin/edit-tag-form.php' ); +include( ABSPATH . 'wp-admin/admin-footer.php' ); diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 4176db18f9..2351f7ca1a 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -926,9 +926,8 @@ function get_edit_term_link( $term_id, $taxonomy, $object_type = '' ) { } $args = array( - 'action' => 'edit', 'taxonomy' => $taxonomy, - 'tag_ID' => $term->term_id, + 'term_id' => $term->term_id, ); if ( $object_type ) { @@ -938,7 +937,7 @@ function get_edit_term_link( $term_id, $taxonomy, $object_type = '' ) { } if ( $tax->show_ui ) { - $location = add_query_arg( $args, admin_url( 'edit-tags.php' ) ); + $location = add_query_arg( $args, admin_url( 'term.php' ) ); } else { $location = ''; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 248514c02f..4b97e26a2f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36307'; +$wp_version = '4.5-alpha-36308'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.