3 * Edit tag form for inclusion in administration panels.
6 * @subpackage Administration
10 if ( !defined('ABSPATH') )
13 if ( empty($tag_ID) ) { ?>
14 <div id="message" class="updated notice is-dismissible"><p><strong><?php _e( 'You did not select an item for editing.' ); ?></strong></p></div>
20 if ( 'category' == $taxonomy ) {
22 * Fires before the Edit Category form.
25 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
27 * @param object $tag Current category term object.
29 do_action( 'edit_category_form_pre', $tag );
30 } elseif ( 'link_category' == $taxonomy ) {
32 * Fires before the Edit Link Category form.
35 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
37 * @param object $tag Current link category term object.
39 do_action( 'edit_link_category_form_pre', $tag );
42 * Fires before the Edit Tag form.
45 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
47 * @param object $tag Current tag term object.
49 do_action( 'edit_tag_form_pre', $tag );
52 * Fires before the Edit Term form for all taxonomies.
54 * The dynamic portion of the hook name, `$taxonomy`, refers to
59 * @param object $tag Current taxonomy term object.
60 * @param string $taxonomy Current $taxonomy slug.
62 do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?>
65 <h1><?php echo $tax->labels->edit_item; ?></h1>
66 <div id="ajax-response"></div>
67 <form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate"
70 * Fires inside the Edit Term form tag.
72 * The dynamic portion of the hook name, `$taxonomy`, refers to
77 do_action( "{$taxonomy}_term_edit_form_tag" );
79 <input type="hidden" name="action" value="editedtag" />
80 <input type="hidden" name="tag_ID" value="<?php echo esc_attr($tag->term_id) ?>" />
81 <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy) ?>" />
82 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_' . $tag_ID); ?>
83 <table class="form-table">
84 <tr class="form-field form-required term-name-wrap">
85 <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th>
86 <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" />
87 <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td>
89 <?php if ( !global_terms_enabled() ) { ?>
90 <tr class="form-field term-slug-wrap">
91 <th scope="row"><label for="slug"><?php _e( 'Slug' ); ?></label></th>
94 * Filter the editable slug.
96 * Note: This is a multi-use hook in that it is leveraged both for editable
97 * post URIs and term slugs.
101 * @param string $slug The editable slug. Will be either a term slug or post URI depending
102 * upon the context in which it is evaluated.
104 $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug ) : '';
106 <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" />
107 <p class="description"><?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></td>
110 <?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?>
111 <tr class="form-field term-parent-wrap">
112 <th scope="row"><label for="parent"><?php _ex( 'Parent', 'term parent' ); ?></label></th>
115 $dropdown_args = array(
117 'hide_if_empty' => false,
118 'taxonomy' => $taxonomy,
121 'selected' => $tag->parent,
122 'exclude_tree' => $tag->term_id,
123 'hierarchical' => true,
124 'show_option_none' => __( 'None' ),
127 /** This filter is documented in wp-admin/edit-tags.php */
128 $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' );
129 wp_dropdown_categories( $dropdown_args ); ?>
130 <?php if ( 'category' == $taxonomy ) : ?>
131 <p class="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>
135 <?php endif; // is_taxonomy_hierarchical() ?>
136 <tr class="form-field term-description-wrap">
137 <th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th>
138 <td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $tag->description; // textarea_escaped ?></textarea>
139 <p class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p></td>
143 if ( 'category' == $taxonomy ) {
145 * Fires after the Edit Category form fields are displayed.
148 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
150 * @param object $tag Current category term object.
152 do_action( 'edit_category_form_fields', $tag );
153 } elseif ( 'link_category' == $taxonomy ) {
155 * Fires after the Edit Link Category form fields are displayed.
158 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
160 * @param object $tag Current link category term object.
162 do_action( 'edit_link_category_form_fields', $tag );
165 * Fires after the Edit Tag form fields are displayed.
168 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
170 * @param object $tag Current tag term object.
172 do_action( 'edit_tag_form_fields', $tag );
175 * Fires after the Edit Term form fields are displayed.
177 * The dynamic portion of the hook name, `$taxonomy`, refers to
182 * @param object $tag Current taxonomy term object.
183 * @param string $taxonomy Current taxonomy slug.
185 do_action( "{$taxonomy}_edit_form_fields", $tag, $taxonomy );
190 if ( 'category' == $taxonomy ) {
191 /** This action is documented in wp-admin/edit-tags.php */
192 do_action( 'edit_category_form', $tag );
193 } elseif ( 'link_category' == $taxonomy ) {
194 /** This action is documented in wp-admin/edit-tags.php */
195 do_action( 'edit_link_category_form', $tag );
198 * Fires at the end of the Edit Term form.
201 * @deprecated 3.0.0 Use {$taxonomy}_edit_form instead.
203 * @param object $tag Current taxonomy term object.
205 do_action( 'edit_tag_form', $tag );
208 * Fires at the end of the Edit Term form for all taxonomies.
210 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
214 * @param object $tag Current taxonomy term object.
215 * @param string $taxonomy Current taxonomy slug.
217 do_action( "{$taxonomy}_edit_form", $tag, $taxonomy );
219 submit_button( __('Update') );
224 <?php if ( ! wp_is_mobile() ) : ?>
225 <script type="text/javascript">
226 try{document.forms.edittag.name.focus();}catch(e){}