edit-tags.php 20 KB

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