equal
deleted
inserted
replaced
6 * @subpackage Administration |
6 * @subpackage Administration |
7 * @since 4.5.0 |
7 * @since 4.5.0 |
8 */ |
8 */ |
9 |
9 |
10 /** WordPress Administration Bootstrap */ |
10 /** WordPress Administration Bootstrap */ |
11 require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 require_once __DIR__ . '/admin.php'; |
12 |
12 |
13 if ( empty( $_REQUEST['tag_ID'] ) ) { |
13 if ( empty( $_REQUEST['tag_ID'] ) ) { |
14 $sendback = admin_url( 'edit-tags.php' ); |
14 $sendback = admin_url( 'edit-tags.php' ); |
15 if ( ! empty( $taxnow ) ) { |
15 if ( ! empty( $taxnow ) ) { |
16 $sendback = add_query_arg( array( 'taxonomy' => $taxnow ), $sendback ); |
16 $sendback = add_query_arg( array( 'taxonomy' => $taxnow ), $sendback ); |
17 } |
17 } |
18 wp_redirect( esc_url( $sendback ) ); |
18 |
|
19 if ( 'post' !== get_current_screen()->post_type ) { |
|
20 $sendback = add_query_arg( 'post_type', get_current_screen()->post_type, $sendback ); |
|
21 } |
|
22 |
|
23 wp_redirect( esc_url_raw( $sendback ) ); |
19 exit; |
24 exit; |
20 } |
25 } |
21 |
26 |
22 $tag_ID = absint( $_REQUEST['tag_ID'] ); |
27 $tag_ID = absint( $_REQUEST['tag_ID'] ); |
23 $tag = get_term( $tag_ID, $taxnow, OBJECT, 'edit' ); |
28 $tag = get_term( $tag_ID, $taxnow, OBJECT, 'edit' ); |
28 |
33 |
29 $tax = get_taxonomy( $tag->taxonomy ); |
34 $tax = get_taxonomy( $tag->taxonomy ); |
30 $taxonomy = $tax->name; |
35 $taxonomy = $tax->name; |
31 $title = $tax->labels->edit_item; |
36 $title = $tax->labels->edit_item; |
32 |
37 |
33 if ( ! in_array( $taxonomy, get_taxonomies( array( 'show_ui' => true ) ) ) || |
38 if ( ! in_array( $taxonomy, get_taxonomies( array( 'show_ui' => true ) ), true ) |
34 ! current_user_can( 'edit_term', $tag->term_id ) ) { |
39 || ! current_user_can( 'edit_term', $tag->term_id ) |
35 |
40 ) { |
36 wp_die( |
41 wp_die( |
37 '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . |
42 '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . |
38 '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>', |
43 '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>', |
39 403 |
44 403 |
40 ); |
45 ); |
45 // Default to the first object_type associated with the taxonomy if no post type was passed. |
50 // Default to the first object_type associated with the taxonomy if no post type was passed. |
46 if ( empty( $post_type ) ) { |
51 if ( empty( $post_type ) ) { |
47 $post_type = reset( $tax->object_type ); |
52 $post_type = reset( $tax->object_type ); |
48 } |
53 } |
49 |
54 |
50 if ( 'post' != $post_type ) { |
55 if ( 'post' !== $post_type ) { |
51 $parent_file = ( 'attachment' == $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type"; |
56 $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"; |
57 $submenu_file = "edit-tags.php?taxonomy=$taxonomy&post_type=$post_type"; |
53 } elseif ( 'link_category' == $taxonomy ) { |
58 } elseif ( 'link_category' === $taxonomy ) { |
54 $parent_file = 'link-manager.php'; |
59 $parent_file = 'link-manager.php'; |
55 $submenu_file = 'edit-tags.php?taxonomy=link_category'; |
60 $submenu_file = 'edit-tags.php?taxonomy=link_category'; |
56 } else { |
61 } else { |
57 $parent_file = 'edit.php'; |
62 $parent_file = 'edit.php'; |
58 $submenu_file = "edit-tags.php?taxonomy=$taxonomy"; |
63 $submenu_file = "edit-tags.php?taxonomy=$taxonomy"; |
63 'heading_pagination' => $tax->labels->items_list_navigation, |
68 'heading_pagination' => $tax->labels->items_list_navigation, |
64 'heading_list' => $tax->labels->items_list, |
69 'heading_list' => $tax->labels->items_list, |
65 ) |
70 ) |
66 ); |
71 ); |
67 wp_enqueue_script( 'admin-tags' ); |
72 wp_enqueue_script( 'admin-tags' ); |
68 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
73 require_once ABSPATH . 'wp-admin/admin-header.php'; |
69 include( ABSPATH . 'wp-admin/edit-tag-form.php' ); |
74 require ABSPATH . 'wp-admin/edit-tag-form.php'; |
70 include( ABSPATH . 'wp-admin/admin-footer.php' ); |
75 require_once ABSPATH . 'wp-admin/admin-footer.php'; |