/wp-admin/edit-tags.php

  1. <?php 
  2. /** 
  3. * Edit Tags Administration Screen. 
  4. * 
  5. * @package WordPress 
  6. * @subpackage Administration 
  7. */ 
  8.  
  9. /** WordPress Administration Bootstrap */ 
  10. require_once( dirname( __FILE__ ) . '/admin.php' ); 
  11.  
  12. if ( ! $taxnow ) 
  13. wp_die( __( 'Invalid taxonomy.' ) ); 
  14.  
  15. $tax = get_taxonomy( $taxnow ); 
  16.  
  17. if ( ! $tax ) 
  18. wp_die( __( 'Invalid taxonomy.' ) ); 
  19.  
  20. if ( ! in_array( $tax->name, get_taxonomies( array( 'show_ui' => true ) ) ) ) { 
  21. wp_die( __( 'Sorry, you are not allowed to manage these items.' ) ); 
  22.  
  23. if ( ! current_user_can( $tax->cap->manage_terms ) ) { 
  24. wp_die( 
  25. '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . 
  26. '<p>' . __( 'Sorry, you are not allowed to manage these items.' ) . '</p>',  
  27. 403 
  28. ); 
  29.  
  30. /** 
  31. * $post_type is set when the WP_Terms_List_Table instance is created 
  32. * 
  33. * @global string $post_type 
  34. */ 
  35. global $post_type; 
  36.  
  37. $wp_list_table = _get_list_table('WP_Terms_List_Table'); 
  38. $pagenum = $wp_list_table->get_pagenum(); 
  39.  
  40. $title = $tax->labels->name; 
  41.  
  42. if ( 'post' != $post_type ) { 
  43. $parent_file = ( 'attachment' == $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type"; 
  44. $submenu_file = "edit-tags.php?taxonomy=$taxonomy&post_type=$post_type"; 
  45. } elseif ( 'link_category' == $tax->name ) { 
  46. $parent_file = 'link-manager.php'; 
  47. $submenu_file = 'edit-tags.php?taxonomy=link_category'; 
  48. } else { 
  49. $parent_file = 'edit.php'; 
  50. $submenu_file = "edit-tags.php?taxonomy=$taxonomy"; 
  51.  
  52. add_screen_option( 'per_page', array( 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page' ) ); 
  53.  
  54. get_current_screen()->set_screen_reader_content( array( 
  55. 'heading_pagination' => $tax->labels->items_list_navigation,  
  56. 'heading_list' => $tax->labels->items_list,  
  57. ) ); 
  58.  
  59. $location = false; 
  60. $referer = wp_get_referer(); 
  61.  
  62. switch ( $wp_list_table->current_action() ) { 
  63.  
  64. case 'add-tag': 
  65.  
  66. check_admin_referer( 'add-tag', '_wpnonce_add-tag' ); 
  67.  
  68. if ( ! current_user_can( $tax->cap->edit_terms ) ) { 
  69. wp_die( 
  70. '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . 
  71. '<p>' . __( 'Sorry, you are not allowed to add this item.' ) . '</p>',  
  72. 403 
  73. ); 
  74.  
  75. $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); 
  76. $location = 'edit-tags.php?taxonomy=' . $taxonomy; 
  77. if ( 'post' != $post_type ) 
  78. $location .= '&post_type=' . $post_type; 
  79.  
  80. if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { 
  81. $location = $referer; 
  82.  
  83. if ( $ret && !is_wp_error( $ret ) ) 
  84. $location = add_query_arg( 'message', 1, $location ); 
  85. else 
  86. $location = add_query_arg( array( 'error' => true, 'message' => 4 ), $location ); 
  87.  
  88. break; 
  89.  
  90. case 'delete': 
  91. $location = 'edit-tags.php?taxonomy=' . $taxonomy; 
  92. if ( 'post' != $post_type ) 
  93. $location .= '&post_type=' . $post_type; 
  94.  
  95. if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { 
  96. $location = $referer; 
  97.  
  98. if ( ! isset( $_REQUEST['tag_ID'] ) ) { 
  99. break; 
  100.  
  101. $tag_ID = (int) $_REQUEST['tag_ID']; 
  102. check_admin_referer( 'delete-tag_' . $tag_ID ); 
  103.  
  104. if ( ! current_user_can( $tax->cap->delete_terms ) ) { 
  105. wp_die( 
  106. '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . 
  107. '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>',  
  108. 403 
  109. ); 
  110.  
  111. wp_delete_term( $tag_ID, $taxonomy ); 
  112.  
  113. $location = add_query_arg( 'message', 2, $location ); 
  114.  
  115. break; 
  116.  
  117. case 'bulk-delete': 
  118. check_admin_referer( 'bulk-tags' ); 
  119.  
  120. if ( ! current_user_can( $tax->cap->delete_terms ) ) { 
  121. wp_die( 
  122. '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . 
  123. '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>',  
  124. 403 
  125. ); 
  126.  
  127. $tags = (array) $_REQUEST['delete_tags']; 
  128. foreach ( $tags as $tag_ID ) { 
  129. wp_delete_term( $tag_ID, $taxonomy ); 
  130.  
  131. $location = 'edit-tags.php?taxonomy=' . $taxonomy; 
  132. if ( 'post' != $post_type ) 
  133. $location .= '&post_type=' . $post_type; 
  134. if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { 
  135. $location = $referer; 
  136.  
  137. $location = add_query_arg( 'message', 6, $location ); 
  138.  
  139. break; 
  140.  
  141. case 'edit': 
  142. if ( ! isset( $_REQUEST['tag_ID'] ) ) { 
  143. break; 
  144.  
  145. $term_id = (int) $_REQUEST['tag_ID']; 
  146. $term = get_term( $term_id ); 
  147.  
  148. if ( ! $term instanceof WP_Term ) { 
  149. wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); 
  150.  
  151. wp_redirect( esc_url_raw( get_edit_term_link( $term_id, $taxonomy, $post_type ) ) ); 
  152. exit; 
  153.  
  154. case 'editedtag': 
  155. $tag_ID = (int) $_POST['tag_ID']; 
  156. check_admin_referer( 'update-tag_' . $tag_ID ); 
  157.  
  158. if ( ! current_user_can( $tax->cap->edit_terms ) ) { 
  159. wp_die( 
  160. '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . 
  161. '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',  
  162. 403 
  163. ); 
  164.  
  165. $tag = get_term( $tag_ID, $taxonomy ); 
  166. if ( ! $tag ) 
  167. wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); 
  168.  
  169. $ret = wp_update_term( $tag_ID, $taxonomy, $_POST ); 
  170.  
  171. $location = 'edit-tags.php?taxonomy=' . $taxonomy; 
  172. if ( 'post' != $post_type ) 
  173. $location .= '&post_type=' . $post_type; 
  174.  
  175. if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { 
  176. $location = $referer; 
  177.  
  178. if ( $ret && !is_wp_error( $ret ) ) 
  179. $location = add_query_arg( 'message', 3, $location ); 
  180. else 
  181. $location = add_query_arg( array( 'error' => true, 'message' => 5 ), $location ); 
  182. break; 
  183.  
  184. if ( ! $location && ! empty( $_REQUEST['_wp_http_referer'] ) ) { 
  185. $location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']) ); 
  186.  
  187. if ( $location ) { 
  188. if ( ! empty( $_REQUEST['paged'] ) ) { 
  189. $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); 
  190.  
  191. /** 
  192. * Filters the taxonomy redirect destination URL. 
  193. * 
  194. * @since 4.6.0 
  195. *  
  196. * @param string $location The destination URL. 
  197. * @param object $tax The taxonomy object. 
  198. */ 
  199. wp_redirect( apply_filters( 'redirect_term_location', $location, $tax ) ); 
  200. exit; 
  201.  
  202. $wp_list_table->prepare_items(); 
  203. $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 
  204.  
  205. if ( $pagenum > $total_pages && $total_pages > 0 ) { 
  206. wp_redirect( add_query_arg( 'paged', $total_pages ) ); 
  207. exit; 
  208.  
  209. wp_enqueue_script('admin-tags'); 
  210. if ( current_user_can($tax->cap->edit_terms) ) 
  211. wp_enqueue_script('inline-edit-tax'); 
  212.  
  213. if ( 'category' == $taxonomy || 'link_category' == $taxonomy || 'post_tag' == $taxonomy ) { 
  214. $help =''; 
  215. if ( 'category' == $taxonomy ) 
  216. $help = '<p>' . sprintf(__( 'You can use categories to define sections of your site and group related posts. The default category is “Uncategorized” until you change it in your <a href="%s">writing settings</a>.' ) , 'options-writing.php' ) . '</p>'; 
  217. elseif ( 'link_category' == $taxonomy ) 
  218. $help = '<p>' . __( 'You can create groups of links by using Link Categories. Link Category names must be unique and Link Categories are separate from the categories you use for posts.' ) . '</p>'; 
  219. else 
  220. $help = '<p>' . __( 'You can assign keywords to your posts using <strong>tags</strong>. Unlike categories, tags have no hierarchy, meaning there’s no relationship from one tag to another.' ) . '</p>'; 
  221.  
  222. if ( 'link_category' == $taxonomy ) 
  223. $help .= '<p>' . __( 'You can delete Link Categories in the Bulk Action pull-down, but that action does not delete the links within the category. Instead, it moves them to the default Link Category.' ) . '</p>'; 
  224. else 
  225. $help .='<p>' . __( 'What’s the difference between categories and tags? Normally, tags are ad-hoc keywords that identify important information in your post (names, subjects, etc) that may or may not recur in other posts, while categories are pre-determined sections. If you think of your site like a book, the categories are like the Table of Contents and the tags are like the terms in the index.' ) . '</p>'; 
  226.  
  227. get_current_screen()->add_help_tab( array( 
  228. 'id' => 'overview',  
  229. 'title' => __('Overview'),  
  230. 'content' => $help,  
  231. ) ); 
  232.  
  233. if ( 'category' == $taxonomy || 'post_tag' == $taxonomy ) { 
  234. if ( 'category' == $taxonomy ) 
  235. $help = '<p>' . __( 'When adding a new category on this screen, you’ll fill in the following fields:' ) . '</p>'; 
  236. else 
  237. $help = '<p>' . __( 'When adding a new tag on this screen, you’ll fill in the following fields:' ) . '</p>'; 
  238.  
  239. $help .= '<ul>' . 
  240. '<li>' . __( '<strong>Name</strong> — The name is how it appears on your site.' ) . '</li>'; 
  241.  
  242. if ( ! global_terms_enabled() ) 
  243. $help .= '<li>' . __( '<strong>Slug</strong> — The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ) . '</li>'; 
  244.  
  245. if ( 'category' == $taxonomy ) 
  246. $help .= '<li>' . __( '<strong>Parent</strong> — Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have child categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.' ) . '</li>'; 
  247.  
  248. $help .= '<li>' . __( '<strong>Description</strong> — The description is not prominent by default; however, some themes may display it.' ) . '</li>' . 
  249. '</ul>' . 
  250. '<p>' . __( 'You can change the display of this screen using the Screen Options tab to set how many items are displayed per screen and to display/hide columns in the table.' ) . '</p>'; 
  251.  
  252. get_current_screen()->add_help_tab( array( 
  253. 'id' => 'adding-terms',  
  254. 'title' => 'category' == $taxonomy ? __( 'Adding Categories' ) : __( 'Adding Tags' ),  
  255. 'content' => $help,  
  256. ) ); 
  257.  
  258. $help = '<p><strong>' . __( 'For more information:' ) . '</strong></p>'; 
  259.  
  260. if ( 'category' == $taxonomy ) 
  261. $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Categories_Screen" target="_blank">Documentation on Categories</a>' ) . '</p>'; 
  262. elseif ( 'link_category' == $taxonomy ) 
  263. $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Links_Link_Categories_Screen" target="_blank">Documentation on Link Categories</a>' ) . '</p>'; 
  264. else 
  265. $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Tags_Screen" target="_blank">Documentation on Tags</a>' ) . '</p>'; 
  266.  
  267. $help .= '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'; 
  268.  
  269. get_current_screen()->set_help_sidebar( $help ); 
  270.  
  271. unset( $help ); 
  272.  
  273. require_once( ABSPATH . 'wp-admin/admin-header.php' ); 
  274.  
  275. if ( ! current_user_can( $tax->cap->edit_terms ) ) { 
  276. wp_die( 
  277. '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . 
  278. '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',  
  279. 403 
  280. ); 
  281.  
  282. /** Also used by the Edit Tag form */ 
  283. require_once( ABSPATH . 'wp-admin/includes/edit-tag-messages.php' ); 
  284.  
  285. $class = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'updated'; 
  286.  
  287. if ( is_plugin_active( 'wpcat2tag-importer/wpcat2tag-importer.php' ) ) { 
  288. $import_link = admin_url( 'admin.php?import=wpcat2tag' ); 
  289. } else { 
  290. $import_link = admin_url( 'import.php' ); 
  291.  
  292. ?> 
  293.  
  294. <div class="wrap nosubsub"> 
  295. <h1><?php echo esc_html( $title ); 
  296. if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { 
  297. /** translators: %s: search keywords */ 
  298. printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( wp_unslash( $_REQUEST['s'] ) ) ); 
  299. ?> 
  300. </h1> 
  301.  
  302. <?php if ( $message ) : ?> 
  303. <div id="message" class="<?php echo $class; ?> notice is-dismissible"><p><?php echo $message; ?></p></div> 
  304. <?php $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message', 'error' ), $_SERVER['REQUEST_URI'] ); 
  305. endif; ?> 
  306. <div id="ajax-response"></div> 
  307.  
  308. <form class="search-form wp-clearfix" method="get"> 
  309. <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" /> 
  310. <input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" /> 
  311.  
  312. <?php $wp_list_table->search_box( $tax->labels->search_items, 'tag' ); ?> 
  313.  
  314. </form> 
  315.  
  316. <div id="col-container" class="wp-clearfix"> 
  317.  
  318. <div id="col-left"> 
  319. <div class="col-wrap"> 
  320.  
  321. <?php 
  322.  
  323. if ( current_user_can($tax->cap->edit_terms) ) { 
  324. if ( 'category' == $taxonomy ) { 
  325. /** 
  326. * Fires before the Add Category form. 
  327. * 
  328. * @since 2.1.0 
  329. * @deprecated 3.0.0 Use {$taxonomy}_pre_add_form instead. 
  330. * 
  331. * @param object $arg Optional arguments cast to an object. 
  332. */ 
  333. do_action( 'add_category_form_pre', (object) array( 'parent' => 0 ) ); 
  334. } elseif ( 'link_category' == $taxonomy ) { 
  335. /** 
  336. * Fires before the link category form. 
  337. * 
  338. * @since 2.3.0 
  339. * @deprecated 3.0.0 Use {$taxonomy}_pre_add_form instead. 
  340. * 
  341. * @param object $arg Optional arguments cast to an object. 
  342. */ 
  343. do_action( 'add_link_category_form_pre', (object) array( 'parent' => 0 ) ); 
  344. } else { 
  345. /** 
  346. * Fires before the Add Tag form. 
  347. * 
  348. * @since 2.5.0 
  349. * @deprecated 3.0.0 Use {$taxonomy}_pre_add_form instead. 
  350. * 
  351. * @param string $taxonomy The taxonomy slug. 
  352. */ 
  353. do_action( 'add_tag_form_pre', $taxonomy ); 
  354.  
  355. /** 
  356. * Fires before the Add Term form for all taxonomies. 
  357. * 
  358. * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 
  359. * 
  360. * @since 3.0.0 
  361. * 
  362. * @param string $taxonomy The taxonomy slug. 
  363. */ 
  364. do_action( "{$taxonomy}_pre_add_form", $taxonomy ); 
  365. ?> 
  366.  
  367. <div class="form-wrap"> 
  368. <h2><?php echo $tax->labels->add_new_item; ?></h2> 
  369. <form id="addtag" method="post" action="edit-tags.php" class="validate" 
  370. <?php 
  371. /** 
  372. * Fires at the beginning of the Add Tag form. 
  373. * 
  374. * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 
  375. * 
  376. * @since 3.7.0 
  377. */ 
  378. do_action( "{$taxonomy}_term_new_form_tag" ); 
  379. ?>> 
  380. <input type="hidden" name="action" value="add-tag" /> 
  381. <input type="hidden" name="screen" value="<?php echo esc_attr($current_screen->id); ?>" /> 
  382. <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" /> 
  383. <input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" /> 
  384. <?php wp_nonce_field('add-tag', '_wpnonce_add-tag'); ?> 
  385.  
  386. <div class="form-field form-required term-name-wrap"> 
  387. <label for="tag-name"><?php _ex( 'Name', 'term name' ); ?></label> 
  388. <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" /> 
  389. <p><?php _e('The name is how it appears on your site.'); ?></p> 
  390. </div> 
  391. <?php if ( ! global_terms_enabled() ) : ?> 
  392. <div class="form-field term-slug-wrap"> 
  393. <label for="tag-slug"><?php _e( 'Slug' ); ?></label> 
  394. <input name="slug" id="tag-slug" type="text" value="" size="40" /> 
  395. <p><?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p> 
  396. </div> 
  397. <?php endif; // global_terms_enabled() ?> 
  398. <?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?> 
  399. <div class="form-field term-parent-wrap"> 
  400. <label for="parent"><?php _ex( 'Parent', 'term parent' ); ?></label> 
  401. <?php 
  402. $dropdown_args = array( 
  403. 'hide_empty' => 0,  
  404. 'hide_if_empty' => false,  
  405. 'taxonomy' => $taxonomy,  
  406. 'name' => 'parent',  
  407. 'orderby' => 'name',  
  408. 'hierarchical' => true,  
  409. 'show_option_none' => __( 'None' ),  
  410. ); 
  411.  
  412. /** 
  413. * Filters the taxonomy parent drop-down on the Edit Term page. 
  414. * 
  415. * @since 3.7.0 
  416. * @since 4.2.0 Added `$context` parameter. 
  417. * 
  418. * @param array $dropdown_args { 
  419. * An array of taxonomy parent drop-down arguments. 
  420. * 
  421. * @type int|bool $hide_empty Whether to hide terms not attached to any posts. Default 0|false. 
  422. * @type bool $hide_if_empty Whether to hide the drop-down if no terms exist. Default false. 
  423. * @type string $taxonomy The taxonomy slug. 
  424. * @type string $name Value of the name attribute to use for the drop-down select element. 
  425. * Default 'parent'. 
  426. * @type string $orderby The field to order by. Default 'name'. 
  427. * @type bool $hierarchical Whether the taxonomy is hierarchical. Default true. 
  428. * @type string $show_option_none Label to display if there are no terms. Default 'None'. 
  429. * } 
  430. * @param string $taxonomy The taxonomy slug. 
  431. * @param string $context Filter context. Accepts 'new' or 'edit'. 
  432. */ 
  433. $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new' ); 
  434.  
  435. wp_dropdown_categories( $dropdown_args ); 
  436. ?> 
  437. <?php if ( 'category' == $taxonomy ) : // @todo: Generic text for hierarchical taxonomies ?> 
  438. <p><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></p> 
  439. <?php endif; ?> 
  440. </div> 
  441. <?php endif; // is_taxonomy_hierarchical() ?> 
  442. <div class="form-field term-description-wrap"> 
  443. <label for="tag-description"><?php _e( 'Description' ); ?></label> 
  444. <textarea name="description" id="tag-description" rows="5" cols="40"></textarea> 
  445. <p><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p> 
  446. </div> 
  447.  
  448. <?php 
  449. if ( ! is_taxonomy_hierarchical( $taxonomy ) ) { 
  450. /** 
  451. * Fires after the Add Tag form fields for non-hierarchical taxonomies. 
  452. * 
  453. * @since 3.0.0 
  454. * 
  455. * @param string $taxonomy The taxonomy slug. 
  456. */ 
  457. do_action( 'add_tag_form_fields', $taxonomy ); 
  458.  
  459. /** 
  460. * Fires after the Add Term form fields. 
  461. * 
  462. * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 
  463. * 
  464. * @since 3.0.0 
  465. * 
  466. * @param string $taxonomy The taxonomy slug. 
  467. */ 
  468. do_action( "{$taxonomy}_add_form_fields", $taxonomy ); 
  469.  
  470. submit_button( $tax->labels->add_new_item ); 
  471.  
  472. if ( 'category' == $taxonomy ) { 
  473. /** 
  474. * Fires at the end of the Edit Category form. 
  475. * 
  476. * @since 2.1.0 
  477. * @deprecated 3.0.0 Use {$taxonomy}_add_form instead. 
  478. * 
  479. * @param object $arg Optional arguments cast to an object. 
  480. */ 
  481. do_action( 'edit_category_form', (object) array( 'parent' => 0 ) ); 
  482. } elseif ( 'link_category' == $taxonomy ) { 
  483. /** 
  484. * Fires at the end of the Edit Link form. 
  485. * 
  486. * @since 2.3.0 
  487. * @deprecated 3.0.0 Use {$taxonomy}_add_form instead. 
  488. * 
  489. * @param object $arg Optional arguments cast to an object. 
  490. */ 
  491. do_action( 'edit_link_category_form', (object) array( 'parent' => 0 ) ); 
  492. } else { 
  493. /** 
  494. * Fires at the end of the Add Tag form. 
  495. * 
  496. * @since 2.7.0 
  497. * @deprecated 3.0.0 Use {$taxonomy}_add_form instead. 
  498. * 
  499. * @param string $taxonomy The taxonomy slug. 
  500. */ 
  501. do_action( 'add_tag_form', $taxonomy ); 
  502.  
  503. /** 
  504. * Fires at the end of the Add Term form for all taxonomies. 
  505. * 
  506. * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 
  507. * 
  508. * @since 3.0.0 
  509. * 
  510. * @param string $taxonomy The taxonomy slug. 
  511. */ 
  512. do_action( "{$taxonomy}_add_form", $taxonomy ); 
  513. ?> 
  514. </form></div> 
  515. <?php } 
  516.  
  517. if ( ! is_null( $tax->labels->popular_items ) ) { 
  518. if ( current_user_can( $tax->cap->edit_terms ) ) { 
  519. $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'post_type' => $post_type, 'echo' => false, 'link' => 'edit' ) ); 
  520. } else { 
  521. $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'echo' => false ) ); 
  522.  
  523. if ( $tag_cloud ) : 
  524. ?> 
  525. <div class="tagcloud"> 
  526. <h2><?php echo $tax->labels->popular_items; ?></h2> 
  527. <?php echo $tag_cloud; unset( $tag_cloud ); ?> 
  528. </div> 
  529. <?php 
  530. endif; 
  531.  
  532. ?> 
  533.  
  534. </div> 
  535. </div><!-- /col-left --> 
  536.  
  537. <div id="col-right"> 
  538. <div class="col-wrap"> 
  539. <form id="posts-filter" method="post"> 
  540. <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" /> 
  541. <input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" /> 
  542.  
  543. <?php $wp_list_table->display(); ?> 
  544.  
  545. </form> 
  546.  
  547. <?php if ( 'category' == $taxonomy ) : ?> 
  548. <div class="form-wrap edit-term-notes"> 
  549. <p> 
  550. <?php 
  551. echo '<strong>' . __( 'Note:' ) . '</strong><br />'; 
  552. printf( 
  553. /** translators: %s: default category */ 
  554. __( 'Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category %s.' ),  
  555. /** This filter is documented in wp-includes/category-template.php */ 
  556. '<strong>' . apply_filters( 'the_category', get_cat_name( get_option( 'default_category') ) ) . '</strong>' 
  557. ); 
  558. ?> 
  559. </p> 
  560. <?php if ( current_user_can( 'import' ) ) : ?> 
  561. <p><?php printf( __( 'Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.' ), esc_url( $import_link ) ) ?></p> 
  562. <?php endif; ?> 
  563. </div> 
  564. <?php elseif ( 'post_tag' == $taxonomy && current_user_can( 'import' ) ) : ?> 
  565. <div class="form-wrap edit-term-notes"> 
  566. <p><?php printf( __( 'Tags can be selectively converted to categories using the <a href="%s">tag to category converter</a>.' ), esc_url( $import_link ) ) ;?></p> 
  567. </div> 
  568. <?php endif; 
  569.  
  570. /** 
  571. * Fires after the taxonomy list table. 
  572. * 
  573. * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 
  574. * 
  575. * @since 3.0.0 
  576. * 
  577. * @param string $taxonomy The taxonomy name. 
  578. */ 
  579. do_action( "after-{$taxonomy}-table", $taxonomy ); 
  580. ?> 
  581.  
  582. </div> 
  583. </div><!-- /col-right --> 
  584.  
  585. </div><!-- /col-container --> 
  586. </div><!-- /wrap --> 
  587.  
  588. <?php if ( ! wp_is_mobile() ) : ?> 
  589. <script type="text/javascript"> 
  590. try{document.forms.addtag['tag-name'].focus();}catch(e) {} 
  591. </script> 
  592. <?php 
  593. endif; 
  594.  
  595. $wp_list_table->inline_edit(); 
  596.  
  597. include( ABSPATH . 'wp-admin/admin-footer.php' ); 
.