[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-admin/ -> edit-tags.php (source)

   1  <?php
   2  /**
   3   * Edit Tags Administration Screen.
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   */
   8  
   9  /** WordPress Administration Bootstrap */
  10  require_once  __DIR__ . '/admin.php';
  11  
  12  if ( ! $taxnow ) {
  13      wp_die( __( 'Invalid taxonomy.' ) );
  14  }
  15  
  16  $tax = get_taxonomy( $taxnow );
  17  
  18  if ( ! $tax ) {
  19      wp_die( __( 'Invalid taxonomy.' ) );
  20  }
  21  
  22  if ( ! in_array( $tax->name, get_taxonomies( array( 'show_ui' => true ) ), true ) ) {
  23      wp_die( __( 'Sorry, you are not allowed to edit terms in this taxonomy.' ) );
  24  }
  25  
  26  if ( ! current_user_can( $tax->cap->manage_terms ) ) {
  27      wp_die(
  28          '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
  29          '<p>' . __( 'Sorry, you are not allowed to manage terms in this taxonomy.' ) . '</p>',
  30          403
  31      );
  32  }
  33  
  34  /**
  35   * $post_type is set when the WP_Terms_List_Table instance is created.
  36   *
  37   * @global string $post_type Global post type.
  38   */
  39  global $post_type;
  40  
  41  $wp_list_table = _get_list_table( 'WP_Terms_List_Table' );
  42  $pagenum       = $wp_list_table->get_pagenum();
  43  
  44  $title = $tax->labels->name;
  45  
  46  if ( 'post' !== $post_type ) {
  47      $parent_file  = ( 'attachment' === $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type";
  48      $submenu_file = "edit-tags.php?taxonomy=$taxonomy&amp;post_type=$post_type";
  49  } elseif ( 'link_category' === $tax->name ) {
  50      $parent_file  = 'link-manager.php';
  51      $submenu_file = 'edit-tags.php?taxonomy=link_category';
  52  } else {
  53      $parent_file  = 'edit.php';
  54      $submenu_file = "edit-tags.php?taxonomy=$taxonomy";
  55  }
  56  
  57  add_screen_option(
  58      'per_page',
  59      array(
  60          'default' => 20,
  61          'option'  => 'edit_' . $tax->name . '_per_page',
  62      )
  63  );
  64  
  65  get_current_screen()->set_screen_reader_content(
  66      array(
  67          'heading_pagination' => $tax->labels->items_list_navigation,
  68          'heading_list'       => $tax->labels->items_list,
  69      )
  70  );
  71  
  72  $location = false;
  73  $referer  = wp_get_referer();
  74  if ( ! $referer ) { // For POST requests.
  75      $referer = wp_unslash( $_SERVER['REQUEST_URI'] );
  76  }
  77  $referer = remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'error', 'message', 'paged' ), $referer );
  78  switch ( $wp_list_table->current_action() ) {
  79  
  80      case 'add-tag':
  81          check_admin_referer( 'add-tag', '_wpnonce_add-tag' );
  82  
  83          if ( ! current_user_can( $tax->cap->edit_terms ) ) {
  84              wp_die(
  85                  '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
  86                  '<p>' . __( 'Sorry, you are not allowed to create terms in this taxonomy.' ) . '</p>',
  87                  403
  88              );
  89          }
  90  
  91          $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST );
  92          if ( $ret && ! is_wp_error( $ret ) ) {
  93              $location = add_query_arg( 'message', 1, $referer );
  94          } else {
  95              $location = add_query_arg(
  96                  array(
  97                      'error'   => true,
  98                      'message' => 4,
  99                  ),
 100                  $referer
 101              );
 102          }
 103  
 104          break;
 105  
 106      case 'delete':
 107          if ( ! isset( $_REQUEST['tag_ID'] ) ) {
 108              break;
 109          }
 110  
 111          $tag_ID = (int) $_REQUEST['tag_ID'];
 112          check_admin_referer( 'delete-tag_' . $tag_ID );
 113  
 114          if ( ! current_user_can( 'delete_term', $tag_ID ) ) {
 115              wp_die(
 116                  '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
 117                  '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>',
 118                  403
 119              );
 120          }
 121  
 122          wp_delete_term( $tag_ID, $taxonomy );
 123  
 124          $location = add_query_arg( 'message', 2, $referer );
 125  
 126          // When deleting a term, prevent the action from redirecting back to a term that no longer exists.
 127          $location = remove_query_arg( array( 'tag_ID', 'action' ), $location );
 128  
 129          break;
 130  
 131      case 'bulk-delete':
 132          check_admin_referer( 'bulk-tags' );
 133  
 134          if ( ! current_user_can( $tax->cap->delete_terms ) ) {
 135              wp_die(
 136                  '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
 137                  '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>',
 138                  403
 139              );
 140          }
 141  
 142          $tags = (array) $_REQUEST['delete_tags'];
 143          foreach ( $tags as $tag_ID ) {
 144              wp_delete_term( $tag_ID, $taxonomy );
 145          }
 146  
 147          $location = add_query_arg( 'message', 6, $referer );
 148  
 149          break;
 150  
 151      case 'edit':
 152          if ( ! isset( $_REQUEST['tag_ID'] ) ) {
 153              break;
 154          }
 155  
 156          $term_id = (int) $_REQUEST['tag_ID'];
 157          $term    = get_term( $term_id );
 158  
 159          if ( ! $term instanceof WP_Term ) {
 160              wp_die( __( 'You attempted to edit an item that does not exist. Perhaps it was deleted?' ) );
 161          }
 162  
 163          wp_redirect( sanitize_url( get_edit_term_link( $term_id, $taxonomy, $post_type ) ) );
 164          exit;
 165  
 166      case 'editedtag':
 167          $tag_ID = (int) $_POST['tag_ID'];
 168          check_admin_referer( 'update-tag_' . $tag_ID );
 169  
 170          if ( ! current_user_can( 'edit_term', $tag_ID ) ) {
 171              wp_die(
 172                  '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
 173                  '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
 174                  403
 175              );
 176          }
 177  
 178          $tag = get_term( $tag_ID, $taxonomy );
 179          if ( ! $tag ) {
 180              wp_die( __( 'You attempted to edit an item that does not exist. Perhaps it was deleted?' ) );
 181          }
 182  
 183          $ret = wp_update_term( $tag_ID, $taxonomy, $_POST );
 184  
 185          if ( $ret && ! is_wp_error( $ret ) ) {
 186              $location = add_query_arg( 'message', 3, $referer );
 187          } else {
 188              $location = add_query_arg(
 189                  array(
 190                      'error'   => true,
 191                      'message' => 5,
 192                  ),
 193                  $referer
 194              );
 195          }
 196          break;
 197      default:
 198          if ( ! $wp_list_table->current_action() || ! isset( $_REQUEST['delete_tags'] ) ) {
 199              break;
 200          }
 201          check_admin_referer( 'bulk-tags' );
 202  
 203          $screen = get_current_screen()->id;
 204          $tags   = (array) $_REQUEST['delete_tags'];
 205  
 206          /** This action is documented in wp-admin/edit.php */
 207          $location = apply_filters( "handle_bulk_actions-{$screen}", $location, $wp_list_table->current_action(), $tags ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
 208          break;
 209  }
 210  
 211  if ( ! $location && ! empty( $_REQUEST['_wp_http_referer'] ) ) {
 212      $location = remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) );
 213  }
 214  
 215  if ( $location ) {
 216      if ( $pagenum > 1 ) {
 217          $location = add_query_arg( 'paged', $pagenum, $location ); // $pagenum takes care of $total_pages.
 218      }
 219      if ( 1 === $pagenum ) {
 220          $location = remove_query_arg( 'paged', $location );
 221      }
 222  
 223      /**
 224       * Filters the taxonomy redirect destination URL.
 225       *
 226       * @since 4.6.0
 227       *
 228       * @param string      $location The destination URL.
 229       * @param WP_Taxonomy $tax      The taxonomy object.
 230       */
 231      wp_redirect( apply_filters( 'redirect_term_location', $location, $tax ) );
 232      exit;
 233  }
 234  
 235  $wp_list_table->prepare_items();
 236  $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
 237  
 238  if ( $pagenum > $total_pages && $total_pages > 0 ) {
 239      wp_redirect( add_query_arg( 'paged', $total_pages ) );
 240      exit;
 241  }
 242  
 243  wp_enqueue_script( 'admin-tags' );
 244  if ( current_user_can( $tax->cap->edit_terms ) ) {
 245      wp_enqueue_script( 'inline-edit-tax' );
 246  }
 247  
 248  if ( 'category' === $taxonomy || 'link_category' === $taxonomy || 'post_tag' === $taxonomy ) {
 249      $help = '';
 250      if ( 'category' === $taxonomy ) {
 251          $help = '<p>' . sprintf(
 252              /* translators: %s: URL to Writing Settings screen. */
 253              __( '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>.' ),
 254              'options-writing.php'
 255          ) . '</p>';
 256      } elseif ( 'link_category' === $taxonomy ) {
 257          $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>';
 258      } else {
 259          $help = '<p>' . __( 'You can assign keywords to your posts using <strong>tags</strong>. Unlike categories, tags have no hierarchy, meaning there is no relationship from one tag to another.' ) . '</p>';
 260      }
 261  
 262      if ( 'link_category' === $taxonomy ) {
 263          $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>';
 264      } else {
 265          $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>';
 266      }
 267  
 268      get_current_screen()->add_help_tab(
 269          array(
 270              'id'      => 'overview',
 271              'title'   => __( 'Overview' ),
 272              'content' => $help,
 273          )
 274      );
 275  
 276      if ( 'category' === $taxonomy || 'post_tag' === $taxonomy ) {
 277          if ( 'category' === $taxonomy ) {
 278              $help = '<p>' . __( 'When adding a new category on this screen, you&#8217;ll fill in the following fields:' ) . '</p>';
 279          } else {
 280              $help = '<p>' . __( 'When adding a new tag on this screen, you&#8217;ll fill in the following fields:' ) . '</p>';
 281          }
 282  
 283          $help .= '<ul>' .
 284          '<li>' . __( '<strong>Name</strong> &mdash; The name is how it appears on your site.' ) . '</li>';
 285  
 286          $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>';
 287  
 288          if ( 'category' === $taxonomy ) {
 289              $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>';
 290          }
 291  
 292          $help .= '<li>' . __( '<strong>Description</strong> &mdash; The description is not prominent by default; however, some themes may display it.' ) . '</li>' .
 293          '</ul>' .
 294          '<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>';
 295  
 296          get_current_screen()->add_help_tab(
 297              array(
 298                  'id'      => 'adding-terms',
 299                  'title'   => 'category' === $taxonomy ? __( 'Adding Categories' ) : __( 'Adding Tags' ),
 300                  'content' => $help,
 301              )
 302          );
 303      }
 304  
 305      $help = '<p><strong>' . __( 'For more information:' ) . '</strong></p>';
 306  
 307      if ( 'category' === $taxonomy ) {
 308          $help .= '<p>' . __( '<a href="https://wordpress.org/documentation/article/posts-categories-screen/">Documentation on Categories</a>' ) . '</p>';
 309      } elseif ( 'link_category' === $taxonomy ) {
 310          $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Links_Link_Categories_Screen">Documentation on Link Categories</a>' ) . '</p>';
 311      } else {
 312          $help .= '<p>' . __( '<a href="https://wordpress.org/documentation/article/posts-tags-screen/">Documentation on Tags</a>' ) . '</p>';
 313      }
 314  
 315      $help .= '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>';
 316  
 317      get_current_screen()->set_help_sidebar( $help );
 318  
 319      unset( $help );
 320  }
 321  
 322  require_once  ABSPATH . 'wp-admin/admin-header.php';
 323  
 324  // Also used by the Edit Tag form.
 325  require_once  ABSPATH . 'wp-admin/includes/edit-tag-messages.php';
 326  
 327  if ( is_plugin_active( 'wpcat2tag-importer/wpcat2tag-importer.php' ) ) {
 328      $import_link = admin_url( 'admin.php?import=wpcat2tag' );
 329  } else {
 330      $import_link = admin_url( 'import.php' );
 331  }
 332  
 333  ?>
 334  
 335  <div class="wrap nosubsub">
 336  <h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1>
 337  
 338  <?php
 339  if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
 340      echo '<span class="subtitle">';
 341      printf(
 342          /* translators: %s: Search query. */
 343          __( 'Search results for: %s' ),
 344          '<strong>' . esc_html( wp_unslash( $_REQUEST['s'] ) ) . '</strong>'
 345      );
 346      echo '</span>';
 347  }
 348  ?>
 349  
 350  <hr class="wp-header-end">
 351  
 352  <?php
 353  $class = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'updated';
 354  
 355  if ( $message ) {
 356      wp_admin_notice(
 357          $message,
 358          array(
 359              'id'                 => 'message',
 360              'additional_classes' => array( $class ),
 361              'dismissible'        => true,
 362          )
 363      );
 364  
 365      $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message', 'error' ), $_SERVER['REQUEST_URI'] );
 366  }
 367  ?>
 368  <div id="ajax-response"></div>
 369  
 370  <form class="search-form wp-clearfix" method="get">
 371  <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" />
 372  <input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" />
 373  
 374  <?php $wp_list_table->search_box( $tax->labels->search_items, 'tag' ); ?>
 375  
 376  </form>
 377  
 378  <?php
 379  $can_edit_terms = current_user_can( $tax->cap->edit_terms );
 380  
 381  if ( $can_edit_terms ) {
 382      ?>
 383  <div id="col-container" class="wp-clearfix">
 384  
 385  <div id="col-left">
 386  <div class="col-wrap">
 387  
 388      <?php
 389      if ( 'category' === $taxonomy ) {
 390          /**
 391           * Fires before the Add Category form.
 392           *
 393           * @since 2.1.0
 394           * @deprecated 3.0.0 Use {@see '{$taxonomy}_pre_add_form'} instead.
 395           *
 396           * @param object $arg Optional arguments cast to an object.
 397           */
 398          do_action_deprecated( 'add_category_form_pre', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_pre_add_form' );
 399      } elseif ( 'link_category' === $taxonomy ) {
 400          /**
 401           * Fires before the link category form.
 402           *
 403           * @since 2.3.0
 404           * @deprecated 3.0.0 Use {@see '{$taxonomy}_pre_add_form'} instead.
 405           *
 406           * @param object $arg Optional arguments cast to an object.
 407           */
 408          do_action_deprecated( 'add_link_category_form_pre', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_pre_add_form' );
 409      } else {
 410          /**
 411           * Fires before the Add Tag form.
 412           *
 413           * @since 2.5.0
 414           * @deprecated 3.0.0 Use {@see '{$taxonomy}_pre_add_form'} instead.
 415           *
 416           * @param string $taxonomy The taxonomy slug.
 417           */
 418          do_action_deprecated( 'add_tag_form_pre', array( $taxonomy ), '3.0.0', '{$taxonomy}_pre_add_form' );
 419      }
 420  
 421      /**
 422       * Fires before the Add Term form for all taxonomies.
 423       *
 424       * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
 425       *
 426       * Possible hook names include:
 427       *
 428       *  - `category_pre_add_form`
 429       *  - `post_tag_pre_add_form`
 430       *
 431       * @since 3.0.0
 432       *
 433       * @param string $taxonomy The taxonomy slug.
 434       */
 435      do_action( "{$taxonomy}_pre_add_form", $taxonomy );
 436      ?>
 437  
 438  <div class="form-wrap">
 439  <h2><?php echo $tax->labels->add_new_item; ?></h2>
 440  <form id="addtag" method="post" action="edit-tags.php" class="validate"
 441      <?php
 442      /**
 443       * Fires inside the Add Tag form tag.
 444       *
 445       * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
 446       *
 447       * Possible hook names include:
 448       *
 449       *  - `category_term_new_form_tag`
 450       *  - `post_tag_term_new_form_tag`
 451       *
 452       * @since 3.7.0
 453       */
 454      do_action( "{$taxonomy}_term_new_form_tag" );
 455      ?>
 456  >
 457  <input type="hidden" name="action" value="add-tag" />
 458  <input type="hidden" name="screen" value="<?php echo esc_attr( $current_screen->id ); ?>" />
 459  <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" />
 460  <input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" />
 461      <?php wp_nonce_field( 'add-tag', '_wpnonce_add-tag' ); ?>
 462  
 463  <div class="form-field form-required term-name-wrap">
 464      <label for="tag-name"><?php _ex( 'Name', 'term name' ); ?></label>
 465      <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" aria-describedby="name-description" />
 466      <p id="name-description"><?php echo $tax->labels->name_field_description; ?></p>
 467  </div>
 468  <div class="form-field term-slug-wrap">
 469      <label for="tag-slug"><?php _e( 'Slug' ); ?></label>
 470      <input name="slug" id="tag-slug" type="text" value="" size="40" aria-describedby="slug-description" />
 471      <p id="slug-description"><?php echo $tax->labels->slug_field_description; ?></p>
 472  </div>
 473      <?php if ( is_taxonomy_hierarchical( $taxonomy ) ) : ?>
 474  <div class="form-field term-parent-wrap">
 475      <label for="parent"><?php echo esc_html( $tax->labels->parent_item ); ?></label>
 476          <?php
 477          $dropdown_args = array(
 478              'hide_empty'       => 0,
 479              'hide_if_empty'    => false,
 480              'taxonomy'         => $taxonomy,
 481              'name'             => 'parent',
 482              'orderby'          => 'name',
 483              'hierarchical'     => true,
 484              'show_option_none' => __( 'None' ),
 485          );
 486  
 487          /**
 488           * Filters the taxonomy parent drop-down on the Edit Term page.
 489           *
 490           * @since 3.7.0
 491           * @since 4.2.0 Added `$context` parameter.
 492           *
 493           * @param array  $dropdown_args {
 494           *     An array of taxonomy parent drop-down arguments.
 495           *
 496           *     @type int|bool $hide_empty       Whether to hide terms not attached to any posts. Default 0.
 497           *     @type bool     $hide_if_empty    Whether to hide the drop-down if no terms exist. Default false.
 498           *     @type string   $taxonomy         The taxonomy slug.
 499           *     @type string   $name             Value of the name attribute to use for the drop-down select element.
 500           *                                      Default 'parent'.
 501           *     @type string   $orderby          The field to order by. Default 'name'.
 502           *     @type bool     $hierarchical     Whether the taxonomy is hierarchical. Default true.
 503           *     @type string   $show_option_none Label to display if there are no terms. Default 'None'.
 504           * }
 505           * @param string $taxonomy The taxonomy slug.
 506           * @param string $context  Filter context. Accepts 'new' or 'edit'.
 507           */
 508          $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new' );
 509  
 510          $dropdown_args['aria_describedby'] = 'parent-description';
 511  
 512          wp_dropdown_categories( $dropdown_args );
 513          ?>
 514          <?php if ( 'category' === $taxonomy ) : ?>
 515          <p id="parent-description"><?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>
 516      <?php else : ?>
 517          <p id="parent-description"><?php echo $tax->labels->parent_field_description; ?></p>
 518      <?php endif; ?>
 519  </div>
 520      <?php endif; // is_taxonomy_hierarchical() ?>
 521  <div class="form-field term-description-wrap">
 522      <label for="tag-description"><?php _e( 'Description' ); ?></label>
 523      <textarea name="description" id="tag-description" rows="5" cols="40" aria-describedby="description-description"></textarea>
 524      <p id="description-description"><?php echo $tax->labels->desc_field_description; ?></p>
 525  </div>
 526  
 527      <?php
 528      if ( ! is_taxonomy_hierarchical( $taxonomy ) ) {
 529          /**
 530           * Fires after the Add Tag form fields for non-hierarchical taxonomies.
 531           *
 532           * @since 3.0.0
 533           *
 534           * @param string $taxonomy The taxonomy slug.
 535           */
 536          do_action( 'add_tag_form_fields', $taxonomy );
 537      }
 538  
 539      /**
 540       * Fires after the Add Term form fields.
 541       *
 542       * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
 543       *
 544       * Possible hook names include:
 545       *
 546       *  - `category_add_form_fields`
 547       *  - `post_tag_add_form_fields`
 548       *
 549       * @since 3.0.0
 550       *
 551       * @param string $taxonomy The taxonomy slug.
 552       */
 553      do_action( "{$taxonomy}_add_form_fields", $taxonomy );
 554      ?>
 555      <p class="submit">
 556          <?php submit_button( $tax->labels->add_new_item, 'primary', 'submit', false ); ?>
 557          <span class="spinner"></span>
 558      </p>
 559      <?php
 560      if ( 'category' === $taxonomy ) {
 561          /**
 562           * Fires at the end of the Edit Category form.
 563           *
 564           * @since 2.1.0
 565           * @deprecated 3.0.0 Use {@see '{$taxonomy}_add_form'} instead.
 566           *
 567           * @param object $arg Optional arguments cast to an object.
 568           */
 569          do_action_deprecated( 'edit_category_form', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_add_form' );
 570      } elseif ( 'link_category' === $taxonomy ) {
 571          /**
 572           * Fires at the end of the Edit Link form.
 573           *
 574           * @since 2.3.0
 575           * @deprecated 3.0.0 Use {@see '{$taxonomy}_add_form'} instead.
 576           *
 577           * @param object $arg Optional arguments cast to an object.
 578           */
 579          do_action_deprecated( 'edit_link_category_form', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_add_form' );
 580      } else {
 581          /**
 582           * Fires at the end of the Add Tag form.
 583           *
 584           * @since 2.7.0
 585           * @deprecated 3.0.0 Use {@see '{$taxonomy}_add_form'} instead.
 586           *
 587           * @param string $taxonomy The taxonomy slug.
 588           */
 589          do_action_deprecated( 'add_tag_form', array( $taxonomy ), '3.0.0', '{$taxonomy}_add_form' );
 590      }
 591  
 592      /**
 593       * Fires at the end of the Add Term form for all taxonomies.
 594       *
 595       * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
 596       *
 597       * Possible hook names include:
 598       *
 599       *  - `category_add_form`
 600       *  - `post_tag_add_form`
 601       *
 602       * @since 3.0.0
 603       *
 604       * @param string $taxonomy The taxonomy slug.
 605       */
 606      do_action( "{$taxonomy}_add_form", $taxonomy );
 607      ?>
 608  </form></div>
 609  </div>
 610  </div><!-- /col-left -->
 611  
 612  <div id="col-right">
 613  <div class="col-wrap">
 614  <?php } ?>
 615  
 616  <?php $wp_list_table->views(); ?>
 617  
 618  <form id="posts-filter" method="post">
 619  <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" />
 620  <input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" />
 621  
 622  <?php $wp_list_table->display(); ?>
 623  
 624  </form>
 625  
 626  <?php if ( 'category' === $taxonomy ) : ?>
 627  <div class="form-wrap edit-term-notes">
 628  <p>
 629      <?php
 630      printf(
 631          /* translators: %s: Default category. */
 632          __( '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 default category %s. The default category cannot be deleted.' ),
 633          /** This filter is documented in wp-includes/category-template.php */
 634          '<strong>' . apply_filters( 'the_category', get_cat_name( get_option( 'default_category' ) ), '', '' ) . '</strong>'
 635      );
 636      ?>
 637  </p>
 638      <?php if ( current_user_can( 'import' ) ) : ?>
 639      <p>
 640          <?php
 641          printf(
 642              /* translators: %s: URL to Categories to Tags Converter tool. */
 643              __( 'Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.' ),
 644              esc_url( $import_link )
 645          );
 646          ?>
 647      </p>
 648      <?php endif; ?>
 649  </div>
 650  <?php elseif ( 'post_tag' === $taxonomy && current_user_can( 'import' ) ) : ?>
 651  <div class="form-wrap edit-term-notes">
 652  <p>
 653      <?php
 654      printf(
 655          /* translators: %s: URL to Categories to Tags Converter tool. */
 656          __( 'Tags can be selectively converted to categories using the <a href="%s">tag to category converter</a>.' ),
 657          esc_url( $import_link )
 658      );
 659      ?>
 660      </p>
 661  </div>
 662      <?php
 663  endif;
 664  
 665  /**
 666   * Fires after the taxonomy list table.
 667   *
 668   * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
 669   *
 670   * Possible hook names include:
 671   *
 672   *  - `after-category-table`
 673   *  - `after-post_tag-table`
 674   *
 675   * @since 3.0.0
 676   *
 677   * @param string $taxonomy The taxonomy name.
 678   */
 679  do_action( "after-{$taxonomy}-table", $taxonomy );  // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
 680  
 681  if ( $can_edit_terms ) {
 682      ?>
 683  </div>
 684  </div><!-- /col-right -->
 685  
 686  </div><!-- /col-container -->
 687  <?php } ?>
 688  
 689  </div><!-- /wrap -->
 690  
 691  <?php if ( ! wp_is_mobile() ) : ?>
 692  <script type="text/javascript">
 693  try{document.forms.addtag['tag-name'].focus();}catch(e){}
 694  </script>
 695      <?php
 696  endif;
 697  
 698  $wp_list_table->inline_edit();
 699  
 700  require_once  ABSPATH . 'wp-admin/admin-footer.php';


Generated : Sat Feb 22 08:20:01 2025 Cross-referenced by PHPXref