3 * Edit Term Administration Screen.
6 * @subpackage Administration
10 /** WordPress Administration Bootstrap */
11 require_once( dirname( __FILE__ ) . '/admin.php' );
13 if ( empty( $_REQUEST['tag_ID'] ) ) {
14 $sendback = admin_url( 'edit-tags.php' );
15 if ( ! empty( $taxnow ) ) {
16 $sendback = add_query_arg( array( 'taxonomy' => $taxnow ), $sendback );
18 wp_redirect( esc_url( $sendback ) );
22 $tag_ID = absint( $_REQUEST['tag_ID'] );
23 $tag = get_term( $tag_ID, $taxnow, OBJECT, 'edit' );
25 if ( ! $tag instanceof WP_Term ) {
26 wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) );
29 $tax = get_taxonomy( $tag->taxonomy );
30 $taxonomy = $tax->name;
31 $title = $tax->labels->edit_item;
33 if ( ! in_array( $taxonomy, get_taxonomies( array( 'show_ui' => true ) ) ) ||
34 ! current_user_can( 'edit_term', $tag->term_id )
37 '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' .
38 '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
43 $post_type = get_current_screen()->post_type;
45 // Default to the first object_type associated with the taxonomy if no post type was passed.
46 if ( empty( $post_type ) ) {
47 $post_type = reset( $tax->object_type );
50 if ( 'post' != $post_type ) {
51 $parent_file = ( 'attachment' == $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type";
52 $submenu_file = "edit-tags.php?taxonomy=$taxonomy&post_type=$post_type";
53 } elseif ( 'link_category' == $taxonomy ) {
54 $parent_file = 'link-manager.php';
55 $submenu_file = 'edit-tags.php?taxonomy=link_category';
57 $parent_file = 'edit.php';
58 $submenu_file = "edit-tags.php?taxonomy=$taxonomy";
61 get_current_screen()->set_screen_reader_content( array(
62 'heading_pagination' => $tax->labels->items_list_navigation,
63 'heading_list' => $tax->labels->items_list,
66 require_once( ABSPATH . 'wp-admin/admin-header.php' );
67 include( ABSPATH . 'wp-admin/edit-tag-form.php' );
68 include( ABSPATH . 'wp-admin/admin-footer.php' );