[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Edit tag form for inclusion in administration panels. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 // Don't load directly. 10 if ( ! defined( 'ABSPATH' ) ) { 11 die( '-1' ); 12 } 13 14 // Back compat hooks. 15 if ( 'category' === $taxonomy ) { 16 /** 17 * Fires before the Edit Category form. 18 * 19 * @since 2.1.0 20 * @deprecated 3.0.0 Use {@see '{$taxonomy}_pre_edit_form'} instead. 21 * 22 * @param WP_Term $tag Current category term object. 23 */ 24 do_action_deprecated( 'edit_category_form_pre', array( $tag ), '3.0.0', '{$taxonomy}_pre_edit_form' ); 25 } elseif ( 'link_category' === $taxonomy ) { 26 /** 27 * Fires before the Edit Link Category form. 28 * 29 * @since 2.3.0 30 * @deprecated 3.0.0 Use {@see '{$taxonomy}_pre_edit_form'} instead. 31 * 32 * @param WP_Term $tag Current link category term object. 33 */ 34 do_action_deprecated( 'edit_link_category_form_pre', array( $tag ), '3.0.0', '{$taxonomy}_pre_edit_form' ); 35 } else { 36 /** 37 * Fires before the Edit Tag form. 38 * 39 * @since 2.5.0 40 * @deprecated 3.0.0 Use {@see '{$taxonomy}_pre_edit_form'} instead. 41 * 42 * @param WP_Term $tag Current tag term object. 43 */ 44 do_action_deprecated( 'edit_tag_form_pre', array( $tag ), '3.0.0', '{$taxonomy}_pre_edit_form' ); 45 } 46 47 /** 48 * Use with caution, see https://developer.wordpress.org/reference/functions/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 57 /** 58 * Fires before the Edit Term form for all taxonomies. 59 * 60 * The dynamic portion of the hook name, `$taxonomy`, refers to 61 * the taxonomy slug. 62 * 63 * Possible hook names include: 64 * 65 * - `category_pre_edit_form` 66 * - `post_tag_pre_edit_form` 67 * 68 * @since 3.0.0 69 * 70 * @param WP_Term $tag Current taxonomy term object. 71 * @param string $taxonomy Current $taxonomy slug. 72 */ 73 do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?> 74 75 <div class="wrap"> 76 <h1><?php echo $tax->labels->edit_item; ?></h1> 77 78 <?php 79 $class = ( isset( $msg ) && 5 === $msg ) ? 'error' : 'success'; 80 81 if ( $message ) { 82 ?> 83 <div id="message" class="notice notice-<?php echo $class; ?>"> 84 <p><strong><?php echo $message; ?></strong></p> 85 <?php if ( $wp_http_referer ) { ?> 86 <p><a href="<?php echo esc_url( wp_validate_redirect( esc_url_raw( $wp_http_referer ), admin_url( 'term.php?taxonomy=' . $taxonomy ) ) ); ?>"> 87 <?php echo esc_html( $tax->labels->back_to_items ); ?> 88 </a></p> 89 <?php } ?> 90 </div> 91 <?php 92 } 93 ?> 94 95 <div id="ajax-response"></div> 96 97 <form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate" 98 <?php 99 /** 100 * Fires inside the Edit Term form tag. 101 * 102 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 103 * 104 * Possible hook names include: 105 * 106 * - `category_term_edit_form_tag` 107 * - `post_tag_term_edit_form_tag` 108 * 109 * @since 3.7.0 110 */ 111 do_action( "{$taxonomy}_term_edit_form_tag" ); 112 ?> 113 > 114 <input type="hidden" name="action" value="editedtag" /> 115 <input type="hidden" name="tag_ID" value="<?php echo esc_attr( $tag_ID ); ?>" /> 116 <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" /> 117 <?php 118 wp_original_referer_field( true, 'previous' ); 119 wp_nonce_field( 'update-tag_' . $tag_ID ); 120 121 /** 122 * Fires at the beginning of the Edit Term form. 123 * 124 * At this point, the required hidden fields and nonces have already been output. 125 * 126 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 127 * 128 * Possible hook names include: 129 * 130 * - `category_term_edit_form_top` 131 * - `post_tag_term_edit_form_top` 132 * 133 * @since 4.5.0 134 * 135 * @param WP_Term $tag Current taxonomy term object. 136 * @param string $taxonomy Current $taxonomy slug. 137 */ 138 do_action( "{$taxonomy}_term_edit_form_top", $tag, $taxonomy ); 139 140 $tag_name_value = ''; 141 if ( isset( $tag->name ) ) { 142 $tag_name_value = esc_attr( $tag->name ); 143 } 144 ?> 145 <table class="form-table" role="presentation"> 146 <tr class="form-field form-required term-name-wrap"> 147 <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th> 148 <td><input name="name" id="name" type="text" value="<?php echo $tag_name_value; ?>" size="40" aria-required="true" /> 149 <p class="description"><?php echo $tax->labels->name_field_description; ?></p></td> 150 </tr> 151 <?php if ( ! global_terms_enabled() ) { ?> 152 <tr class="form-field term-slug-wrap"> 153 <th scope="row"><label for="slug"><?php _e( 'Slug' ); ?></label></th> 154 <?php 155 /** 156 * Filters the editable slug for a post or term. 157 * 158 * Note: This is a multi-use hook in that it is leveraged both for editable 159 * post URIs and term slugs. 160 * 161 * @since 2.6.0 162 * @since 4.4.0 The `$tag` parameter was added. 163 * 164 * @param string $slug The editable slug. Will be either a term slug or post URI depending 165 * upon the context in which it is evaluated. 166 * @param WP_Term|WP_Post $tag Term or post object. 167 */ 168 $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : ''; 169 ?> 170 <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" /> 171 <p class="description"><?php echo $tax->labels->slug_field_description; ?></p></td> 172 </tr> 173 <?php } ?> 174 <?php if ( is_taxonomy_hierarchical( $taxonomy ) ) : ?> 175 <tr class="form-field term-parent-wrap"> 176 <th scope="row"><label for="parent"><?php echo esc_html( $tax->labels->parent_item ); ?></label></th> 177 <td> 178 <?php 179 $dropdown_args = array( 180 'hide_empty' => 0, 181 'hide_if_empty' => false, 182 'taxonomy' => $taxonomy, 183 'name' => 'parent', 184 'orderby' => 'name', 185 'selected' => $tag->parent, 186 'exclude_tree' => $tag->term_id, 187 'hierarchical' => true, 188 'show_option_none' => __( 'None' ), 189 ); 190 191 /** This filter is documented in wp-admin/edit-tags.php */ 192 $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' ); 193 wp_dropdown_categories( $dropdown_args ); 194 ?> 195 <?php if ( 'category' === $taxonomy ) : ?> 196 <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> 197 <?php else : ?> 198 <p class="description"><?php echo $tax->labels->parent_field_description; ?></p> 199 <?php endif; ?> 200 </td> 201 </tr> 202 <?php endif; // is_taxonomy_hierarchical() ?> 203 <tr class="form-field term-description-wrap"> 204 <th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th> 205 <td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $tag->description; // textarea_escaped ?></textarea> 206 <p class="description"><?php echo $tax->labels->desc_field_description; ?></p></td> 207 </tr> 208 <?php 209 // Back compat hooks. 210 if ( 'category' === $taxonomy ) { 211 /** 212 * Fires after the Edit Category form fields are displayed. 213 * 214 * @since 2.9.0 215 * @deprecated 3.0.0 Use {@see '{$taxonomy}_edit_form_fields'} instead. 216 * 217 * @param WP_Term $tag Current category term object. 218 */ 219 do_action_deprecated( 'edit_category_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' ); 220 } elseif ( 'link_category' === $taxonomy ) { 221 /** 222 * Fires after the Edit Link Category form fields are displayed. 223 * 224 * @since 2.9.0 225 * @deprecated 3.0.0 Use {@see '{$taxonomy}_edit_form_fields'} instead. 226 * 227 * @param WP_Term $tag Current link category term object. 228 */ 229 do_action_deprecated( 'edit_link_category_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' ); 230 } else { 231 /** 232 * Fires after the Edit Tag form fields are displayed. 233 * 234 * @since 2.9.0 235 * @deprecated 3.0.0 Use {@see '{$taxonomy}_edit_form_fields'} instead. 236 * 237 * @param WP_Term $tag Current tag term object. 238 */ 239 do_action_deprecated( 'edit_tag_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' ); 240 } 241 /** 242 * Fires after the Edit Term form fields are displayed. 243 * 244 * The dynamic portion of the hook name, `$taxonomy`, refers to 245 * the taxonomy slug. 246 * 247 * Possible hook names include: 248 * 249 * - `category_edit_form_fields` 250 * - `post_tag_edit_form_fields` 251 * 252 * @since 3.0.0 253 * 254 * @param WP_Term $tag Current taxonomy term object. 255 * @param string $taxonomy Current taxonomy slug. 256 */ 257 do_action( "{$taxonomy}_edit_form_fields", $tag, $taxonomy ); 258 ?> 259 </table> 260 <?php 261 // Back compat hooks. 262 if ( 'category' === $taxonomy ) { 263 /** This action is documented in wp-admin/edit-tags.php */ 264 do_action_deprecated( 'edit_category_form', array( $tag ), '3.0.0', '{$taxonomy}_add_form' ); 265 } elseif ( 'link_category' === $taxonomy ) { 266 /** This action is documented in wp-admin/edit-tags.php */ 267 do_action_deprecated( 'edit_link_category_form', array( $tag ), '3.0.0', '{$taxonomy}_add_form' ); 268 } else { 269 /** 270 * Fires at the end of the Edit Term form. 271 * 272 * @since 2.5.0 273 * @deprecated 3.0.0 Use {@see '{$taxonomy}_edit_form'} instead. 274 * 275 * @param WP_Term $tag Current taxonomy term object. 276 */ 277 do_action_deprecated( 'edit_tag_form', array( $tag ), '3.0.0', '{$taxonomy}_edit_form' ); 278 } 279 /** 280 * Fires at the end of the Edit Term form for all taxonomies. 281 * 282 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 283 * 284 * Possible hook names include: 285 * 286 * - `category_edit_form` 287 * - `post_tag_edit_form` 288 * 289 * @since 3.0.0 290 * 291 * @param WP_Term $tag Current taxonomy term object. 292 * @param string $taxonomy Current taxonomy slug. 293 */ 294 do_action( "{$taxonomy}_edit_form", $tag, $taxonomy ); 295 ?> 296 297 <div class="edit-tag-actions"> 298 299 <?php submit_button( __( 'Update' ), 'primary', null, false ); ?> 300 301 <?php if ( current_user_can( 'delete_term', $tag->term_id ) ) : ?> 302 <span id="delete-link"> 303 <a class="delete" href="<?php echo esc_url( 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> 304 </span> 305 <?php endif; ?> 306 307 </div> 308 309 </form> 310 </div> 311 312 <?php if ( ! wp_is_mobile() ) : ?> 313 <script type="text/javascript"> 314 try{document.forms.edittag.name.focus();}catch(e){} 315 </script> 316 <?php 317 endif;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Nov 12 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |