3 * Edit tag form for inclusion in administration panels.
6 * @subpackage Administration
10 if ( ! defined( 'ABSPATH' ) ) {
15 if ( 'category' == $taxonomy ) {
17 * Fires before the Edit Category form.
20 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
22 * @param object $tag Current category term object.
24 do_action( 'edit_category_form_pre', $tag );
25 } elseif ( 'link_category' == $taxonomy ) {
27 * Fires before the Edit Link Category form.
30 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
32 * @param object $tag Current link category term object.
34 do_action( 'edit_link_category_form_pre', $tag );
37 * Fires before the Edit Tag form.
40 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
42 * @param object $tag Current tag term object.
44 do_action( 'edit_tag_form_pre', $tag );
48 * Use with caution, see http://codex.wordpress.org/Function_Reference/wp_reset_vars
50 wp_reset_vars( array( 'wp_http_referer' ) );
52 $wp_http_referer = remove_query_arg( array( 'action', 'message', 'tag_ID' ), $wp_http_referer );
54 /** Also used by Edit Tags */
55 require_once( ABSPATH . 'wp-admin/includes/edit-tag-messages.php' );
58 * Fires before the Edit Term form for all taxonomies.
60 * The dynamic portion of the hook name, `$taxonomy`, refers to
65 * @param object $tag Current taxonomy term object.
66 * @param string $taxonomy Current $taxonomy slug.
68 do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?>
71 <h1><?php echo $tax->labels->edit_item; ?></h1>
73 <?php if ( $message ) : ?>
74 <div id="message" class="updated">
75 <p><strong><?php echo $message; ?></strong></p>
76 <?php if ( $wp_http_referer ) { ?>
77 <p><a href="<?php echo esc_url( $wp_http_referer ); ?>"><?php printf( __( '← Back to %s' ), $tax->labels->name ); ?></a></p>
79 <p><a href="<?php echo esc_url( wp_get_referer() ); ?>"><?php printf( __( '← Back to %s' ), $tax->labels->name ); ?></a></p>
84 <div id="ajax-response"></div>
86 <form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate"
89 * Fires inside the Edit Term form tag.
91 * The dynamic portion of the hook name, `$taxonomy`, refers to
96 do_action( "{$taxonomy}_term_edit_form_tag" );
98 <input type="hidden" name="action" value="editedtag"/>
99 <input type="hidden" name="tag_ID" value="<?php echo esc_attr( $tag_ID ) ?>"/>
100 <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ) ?>"/>
102 wp_original_referer_field( true, 'previous' );
103 wp_nonce_field( 'update-tag_' . $tag_ID );
106 * Fires at the beginning of the Edit Term form.
108 * At this point, the required hidden fields and nonces have already been output.
110 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
114 * @param object $tag Current taxonomy term object.
115 * @param string $taxonomy Current $taxonomy slug.
117 do_action( "{$taxonomy}_term_edit_form_top", $tag, $taxonomy );
119 <table class="form-table">
120 <tr class="form-field form-required term-name-wrap">
121 <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th>
122 <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" />
123 <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td>
125 <?php if ( !global_terms_enabled() ) { ?>
126 <tr class="form-field term-slug-wrap">
127 <th scope="row"><label for="slug"><?php _e( 'Slug' ); ?></label></th>
130 * Filter the editable slug.
132 * Note: This is a multi-use hook in that it is leveraged both for editable
133 * post URIs and term slugs.
136 * @since 4.4.0 The `$tag` parameter was added.
138 * @param string $slug The editable slug. Will be either a term slug or post URI depending
139 * upon the context in which it is evaluated.
140 * @param object|WP_Post $tag Term or WP_Post object.
142 $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : '';
144 <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" />
145 <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>
148 <?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?>
149 <tr class="form-field term-parent-wrap">
150 <th scope="row"><label for="parent"><?php _ex( 'Parent', 'term parent' ); ?></label></th>
153 $dropdown_args = array(
155 'hide_if_empty' => false,
156 'taxonomy' => $taxonomy,
159 'selected' => $tag->parent,
160 'exclude_tree' => $tag->term_id,
161 'hierarchical' => true,
162 'show_option_none' => __( 'None' ),
165 /** This filter is documented in wp-admin/edit-tags.php */
166 $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' );
167 wp_dropdown_categories( $dropdown_args ); ?>
168 <?php if ( 'category' == $taxonomy ) : ?>
169 <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>
173 <?php endif; // is_taxonomy_hierarchical() ?>
174 <tr class="form-field term-description-wrap">
175 <th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th>
176 <td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $tag->description; // textarea_escaped ?></textarea>
177 <p class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p></td>
181 if ( 'category' == $taxonomy ) {
183 * Fires after the Edit Category form fields are displayed.
186 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
188 * @param object $tag Current category term object.
190 do_action( 'edit_category_form_fields', $tag );
191 } elseif ( 'link_category' == $taxonomy ) {
193 * Fires after the Edit Link Category form fields are displayed.
196 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
198 * @param object $tag Current link category term object.
200 do_action( 'edit_link_category_form_fields', $tag );
203 * Fires after the Edit Tag form fields are displayed.
206 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
208 * @param object $tag Current tag term object.
210 do_action( 'edit_tag_form_fields', $tag );
213 * Fires after the Edit Term form fields are displayed.
215 * The dynamic portion of the hook name, `$taxonomy`, refers to
220 * @param object $tag Current taxonomy term object.
221 * @param string $taxonomy Current taxonomy slug.
223 do_action( "{$taxonomy}_edit_form_fields", $tag, $taxonomy );
228 if ( 'category' == $taxonomy ) {
229 /** This action is documented in wp-admin/edit-tags.php */
230 do_action( 'edit_category_form', $tag );
231 } elseif ( 'link_category' == $taxonomy ) {
232 /** This action is documented in wp-admin/edit-tags.php */
233 do_action( 'edit_link_category_form', $tag );
236 * Fires at the end of the Edit Term form.
239 * @deprecated 3.0.0 Use {$taxonomy}_edit_form instead.
241 * @param object $tag Current taxonomy term object.
243 do_action( 'edit_tag_form', $tag );
246 * Fires at the end of the Edit Term form for all taxonomies.
248 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
252 * @param object $tag Current taxonomy term object.
253 * @param string $taxonomy Current taxonomy slug.
255 do_action( "{$taxonomy}_edit_form", $tag, $taxonomy );
257 submit_button( __('Update') );
262 <?php if ( ! wp_is_mobile() ) : ?>
263 <script type="text/javascript">
264 try{document.forms.edittag.name.focus();}catch(e){}