[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
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 __DIR__ . '/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 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( sanitize_url( $sendback ) ); 24 exit; 25 } 26 27 $tag_ID = absint( $_REQUEST['tag_ID'] ); 28 $tag = get_term( $tag_ID, $taxnow, OBJECT, 'edit' ); 29 30 if ( ! $tag instanceof WP_Term ) { 31 wp_die( __( 'You attempted to edit an item that does not exist. Perhaps it was deleted?' ) ); 32 } 33 34 $tax = get_taxonomy( $tag->taxonomy ); 35 $taxonomy = $tax->name; 36 $title = $tax->labels->edit_item; 37 38 if ( ! in_array( $taxonomy, get_taxonomies( array( 'show_ui' => true ) ), true ) 39 || ! current_user_can( 'edit_term', $tag->term_id ) 40 ) { 41 wp_die( 42 '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . 43 '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>', 44 403 45 ); 46 } 47 48 $post_type = get_current_screen()->post_type; 49 50 // Default to the first object_type associated with the taxonomy if no post type was passed. 51 if ( empty( $post_type ) ) { 52 $post_type = reset( $tax->object_type ); 53 } 54 55 if ( 'post' !== $post_type ) { 56 $parent_file = ( 'attachment' === $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type"; 57 $submenu_file = "edit-tags.php?taxonomy=$taxonomy&post_type=$post_type"; 58 } elseif ( 'link_category' === $taxonomy ) { 59 $parent_file = 'link-manager.php'; 60 $submenu_file = 'edit-tags.php?taxonomy=link_category'; 61 } else { 62 $parent_file = 'edit.php'; 63 $submenu_file = "edit-tags.php?taxonomy=$taxonomy"; 64 } 65 66 get_current_screen()->set_screen_reader_content( 67 array( 68 'heading_pagination' => $tax->labels->items_list_navigation, 69 'heading_list' => $tax->labels->items_list, 70 ) 71 ); 72 wp_enqueue_script( 'admin-tags' ); 73 require_once ABSPATH . 'wp-admin/admin-header.php'; 74 require ABSPATH . 'wp-admin/edit-tag-form.php'; 75 require_once ABSPATH . 'wp-admin/admin-footer.php';
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Sat Nov 23 08:20:01 2024 | Cross-referenced by PHPXref |