]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/term.php
WordPress 4.5-scripts
[autoinstalls/wordpress.git] / wp-admin / term.php
1 <?php
2 /**
3  * Edit Term Administration Screen.
4  *
5  * @package WordPress
6  * @subpackage Administration
7  * @since 4.5.0
8  */
9
10 /** WordPress Administration Bootstrap */
11 require_once( dirname( __FILE__ ) . '/admin.php' );
12
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 );
17         }
18         wp_redirect( esc_url( $sendback ) );
19         exit;
20 }
21
22 $tag_ID = absint( $_REQUEST['tag_ID'] );
23 $tag    = get_term( $tag_ID, '', OBJECT, 'edit' );
24
25 if ( ! $tag instanceof WP_Term ) {
26         wp_die( __( 'You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?' ) );
27 }
28
29 $tax      = get_taxonomy( $tag->taxonomy );
30 $taxonomy = $tax->name;
31 $title    = $tax->labels->edit_item;
32
33 if ( ! in_array( $taxonomy, get_taxonomies( array( 'show_ui' => true ) ) ) ||
34      ! current_user_can( $tax->cap->manage_terms )
35 ) {
36         wp_die(
37                 '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
38                 '<p>' . __( 'You are not allowed to manage this item.' ) . '</p>',
39                 403
40         );
41 }
42
43 $post_type = get_current_screen()->post_type;
44
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 );
48 }
49
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&amp;post_type=$post_type";
53 } elseif ( 'link_category' == $taxonomy ) {
54         $parent_file  = 'link-manager.php';
55         $submenu_file = 'edit-tags.php?taxonomy=link_category';
56 } else {
57         $parent_file  = 'edit.php';
58         $submenu_file = "edit-tags.php?taxonomy=$taxonomy";
59 }
60
61 get_current_screen()->set_screen_reader_content( array(
62         'heading_pagination' => $tax->labels->items_list_navigation,
63         'heading_list'       => $tax->labels->items_list,
64 ) );
65
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' );