46 * |
41 * |
47 * @param object $tag Current tag term object. |
42 * @param object $tag Current tag term object. |
48 */ |
43 */ |
49 do_action( 'edit_tag_form_pre', $tag ); |
44 do_action( 'edit_tag_form_pre', $tag ); |
50 } |
45 } |
|
46 |
|
47 /** |
|
48 * Use with caution, see https://codex.wordpress.org/Function_Reference/wp_reset_vars |
|
49 */ |
|
50 wp_reset_vars( array( 'wp_http_referer' ) ); |
|
51 |
|
52 $wp_http_referer = remove_query_arg( array( 'action', 'message', 'tag_ID' ), $wp_http_referer ); |
|
53 |
|
54 /** Also used by Edit Tags */ |
|
55 require_once( ABSPATH . 'wp-admin/includes/edit-tag-messages.php' ); |
|
56 |
51 /** |
57 /** |
52 * Fires before the Edit Term form for all taxonomies. |
58 * Fires before the Edit Term form for all taxonomies. |
53 * |
59 * |
54 * The dynamic portion of the hook name, `$taxonomy`, refers to |
60 * The dynamic portion of the hook name, `$taxonomy`, refers to |
55 * the taxonomy slug. |
61 * the taxonomy slug. |
60 * @param string $taxonomy Current $taxonomy slug. |
66 * @param string $taxonomy Current $taxonomy slug. |
61 */ |
67 */ |
62 do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?> |
68 do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?> |
63 |
69 |
64 <div class="wrap"> |
70 <div class="wrap"> |
65 <h2><?php echo $tax->labels->edit_item; ?></h2> |
71 <h1><?php echo $tax->labels->edit_item; ?></h1> |
|
72 |
|
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_validate_redirect( esc_url_raw( $wp_http_referer ), admin_url( 'term.php?taxonomy=' . $taxonomy ) ) ); ?>"><?php |
|
78 echo esc_html( $tax->labels->back_to_items ); |
|
79 ?></a></p> |
|
80 <?php } ?> |
|
81 </div> |
|
82 <?php endif; ?> |
|
83 |
66 <div id="ajax-response"></div> |
84 <div id="ajax-response"></div> |
67 <form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate" |
85 |
68 <?php |
86 <form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate"<?php |
69 /** |
87 /** |
70 * Fires inside the Edit Term form tag. |
88 * Fires inside the Edit Term form tag. |
71 * |
89 * |
72 * The dynamic portion of the hook name, `$taxonomy`, refers to |
90 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. |
73 * the taxonomy slug. |
|
74 * |
91 * |
75 * @since 3.7.0 |
92 * @since 3.7.0 |
76 */ |
93 */ |
77 do_action( "{$taxonomy}_term_edit_form_tag" ); |
94 do_action( "{$taxonomy}_term_edit_form_tag" ); |
78 ?>> |
95 ?>> |
79 <input type="hidden" name="action" value="editedtag" /> |
96 <input type="hidden" name="action" value="editedtag"/> |
80 <input type="hidden" name="tag_ID" value="<?php echo esc_attr($tag->term_id) ?>" /> |
97 <input type="hidden" name="tag_ID" value="<?php echo esc_attr( $tag_ID ) ?>"/> |
81 <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy) ?>" /> |
98 <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); ?> |
99 <?php |
|
100 wp_original_referer_field( true, 'previous' ); |
|
101 wp_nonce_field( 'update-tag_' . $tag_ID ); |
|
102 |
|
103 /** |
|
104 * Fires at the beginning of the Edit Term form. |
|
105 * |
|
106 * At this point, the required hidden fields and nonces have already been output. |
|
107 * |
|
108 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. |
|
109 * |
|
110 * @since 4.5.0 |
|
111 * |
|
112 * @param object $tag Current taxonomy term object. |
|
113 * @param string $taxonomy Current $taxonomy slug. |
|
114 */ |
|
115 do_action( "{$taxonomy}_term_edit_form_top", $tag, $taxonomy ); |
|
116 ?> |
83 <table class="form-table"> |
117 <table class="form-table"> |
84 <tr class="form-field form-required term-name-wrap"> |
118 <tr class="form-field form-required term-name-wrap"> |
85 <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th> |
119 <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" /> |
120 <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> |
121 <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td> |
89 <?php if ( !global_terms_enabled() ) { ?> |
123 <?php if ( !global_terms_enabled() ) { ?> |
90 <tr class="form-field term-slug-wrap"> |
124 <tr class="form-field term-slug-wrap"> |
91 <th scope="row"><label for="slug"><?php _e( 'Slug' ); ?></label></th> |
125 <th scope="row"><label for="slug"><?php _e( 'Slug' ); ?></label></th> |
92 <?php |
126 <?php |
93 /** |
127 /** |
94 * Filter the editable slug. |
128 * Filters the editable slug. |
95 * |
129 * |
96 * Note: This is a multi-use hook in that it is leveraged both for editable |
130 * Note: This is a multi-use hook in that it is leveraged both for editable |
97 * post URIs and term slugs. |
131 * post URIs and term slugs. |
98 * |
132 * |
99 * @since 2.6.0 |
133 * @since 2.6.0 |
100 * |
134 * @since 4.4.0 The `$tag` parameter was added. |
101 * @param string $slug The editable slug. Will be either a term slug or post URI depending |
135 * |
102 * upon the context in which it is evaluated. |
136 * @param string $slug The editable slug. Will be either a term slug or post URI depending |
103 */ |
137 * upon the context in which it is evaluated. |
104 $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug ) : ''; |
138 * @param object|WP_Post $tag Term or WP_Post object. |
|
139 */ |
|
140 $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : ''; |
105 ?> |
141 ?> |
106 <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" /> |
142 <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> |
143 <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> |
108 </tr> |
144 </tr> |
109 <?php } ?> |
145 <?php } ?> |
110 <?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?> |
146 <?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?> |
111 <tr class="form-field term-parent-wrap"> |
147 <tr class="form-field term-parent-wrap"> |
112 <th scope="row"><label for="parent"><?php _ex( 'Parent', 'term parent' ); ?></label></th> |
148 <th scope="row"><label for="parent"><?php echo esc_html( $tax->labels->parent_item ); ?></label></th> |
113 <td> |
149 <td> |
114 <?php |
150 <?php |
115 $dropdown_args = array( |
151 $dropdown_args = array( |
116 'hide_empty' => 0, |
152 'hide_empty' => 0, |
117 'hide_if_empty' => false, |
153 'hide_if_empty' => false, |
126 |
162 |
127 /** This filter is documented in wp-admin/edit-tags.php */ |
163 /** This filter is documented in wp-admin/edit-tags.php */ |
128 $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' ); |
164 $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' ); |
129 wp_dropdown_categories( $dropdown_args ); ?> |
165 wp_dropdown_categories( $dropdown_args ); ?> |
130 <?php if ( 'category' == $taxonomy ) : ?> |
166 <?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> |
167 <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> |
|
168 <?php else : ?> |
|
169 <p class="description"><?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> |
132 <?php endif; ?> |
170 <?php endif; ?> |
133 </td> |
171 </td> |
134 </tr> |
172 </tr> |
135 <?php endif; // is_taxonomy_hierarchical() ?> |
173 <?php endif; // is_taxonomy_hierarchical() ?> |
136 <tr class="form-field term-description-wrap"> |
174 <tr class="form-field term-description-wrap"> |
213 * |
251 * |
214 * @param object $tag Current taxonomy term object. |
252 * @param object $tag Current taxonomy term object. |
215 * @param string $taxonomy Current taxonomy slug. |
253 * @param string $taxonomy Current taxonomy slug. |
216 */ |
254 */ |
217 do_action( "{$taxonomy}_edit_form", $tag, $taxonomy ); |
255 do_action( "{$taxonomy}_edit_form", $tag, $taxonomy ); |
218 |
|
219 submit_button( __('Update') ); |
|
220 ?> |
256 ?> |
|
257 |
|
258 <div class="edit-tag-actions"> |
|
259 |
|
260 <?php submit_button( __( 'Update' ), 'primary', null, false ); ?> |
|
261 |
|
262 <?php if ( current_user_can( 'delete_term', $tag->term_id ) ) : ?> |
|
263 <span id="delete-link"> |
|
264 <a class="delete" href="<?php echo admin_url( wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) ) ?>"><?php _e( 'Delete' ); ?></a> |
|
265 </span> |
|
266 <?php endif; ?> |
|
267 |
|
268 </div> |
|
269 |
221 </form> |
270 </form> |
222 </div> |
271 </div> |
223 |
272 |
224 <?php if ( ! wp_is_mobile() ) : ?> |
273 <?php if ( ! wp_is_mobile() ) : ?> |
225 <script type="text/javascript"> |
274 <script type="text/javascript"> |