[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[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 $message = '<p><strong>' . $message . '</strong></p>'; 83 if ( $wp_http_referer ) { 84 $message .= '<p><a href="' . esc_url( wp_validate_redirect( sanitize_url( $wp_http_referer ), admin_url( 'term.php?taxonomy=' . $taxonomy ) ) ) . '">' . esc_html( $tax->labels->back_to_items ) . '</a></p>'; 85 } 86 wp_admin_notice( 87 $message, 88 array( 89 'type' => $class, 90 'id' => 'message', 91 'paragraph_wrap' => false, 92 ) 93 ); 94 } 95 ?> 96 97 <div id="ajax-response"></div> 98 99 <form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate" 100 <?php 101 /** 102 * Fires inside the Edit Term form tag. 103 * 104 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 105 * 106 * Possible hook names include: 107 * 108 * - `category_term_edit_form_tag` 109 * - `post_tag_term_edit_form_tag` 110 * 111 * @since 3.7.0 112 */ 113 do_action( "{$taxonomy}_term_edit_form_tag" ); 114 ?> 115 > 116 <input type="hidden" name="action" value="editedtag" /> 117 <input type="hidden" name="tag_ID" value="<?php echo esc_attr( $tag_ID ); ?>" /> 118 <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" /> 119 <?php 120 wp_original_referer_field( true, 'previous' ); 121 wp_nonce_field( 'update-tag_' . $tag_ID ); 122 123 /** 124 * Fires at the beginning of the Edit Term form. 125 * 126 * At this point, the required hidden fields and nonces have already been output. 127 * 128 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 129 * 130 * Possible hook names include: 131 * 132 * - `category_term_edit_form_top` 133 * - `post_tag_term_edit_form_top` 134 * 135 * @since 4.5.0 136 * 137 * @param WP_Term $tag Current taxonomy term object. 138 * @param string $taxonomy Current $taxonomy slug. 139 */ 140 do_action( "{$taxonomy}_term_edit_form_top", $tag, $taxonomy ); 141 142 $tag_name_value = ''; 143 if ( isset( $tag->name ) ) { 144 $tag_name_value = esc_attr( $tag->name ); 145 } 146 ?> 147 <table class="form-table" role="presentation"> 148 <tr class="form-field form-required term-name-wrap"> 149 <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th> 150 <td><input name="name" id="name" type="text" value="<?php echo $tag_name_value; ?>" size="40" aria-required="true" aria-describedby="name-description" /> 151 <p class="description" id="name-description"><?php echo $tax->labels->name_field_description; ?></p></td> 152 </tr> 153 <tr class="form-field term-slug-wrap"> 154 <th scope="row"><label for="slug"><?php _e( 'Slug' ); ?></label></th> 155 <?php 156 /** 157 * Filters the editable slug for a post or term. 158 * 159 * Note: This is a multi-use hook in that it is leveraged both for editable 160 * post URIs and term slugs. 161 * 162 * @since 2.6.0 163 * @since 4.4.0 The `$tag` parameter was added. 164 * 165 * @param string $slug The editable slug. Will be either a term slug or post URI depending 166 * upon the context in which it is evaluated. 167 * @param WP_Term|WP_Post $tag Term or post object. 168 */ 169 $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : ''; 170 ?> 171 <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" aria-describedby="slug-description" /> 172 <p class="description" id="slug-description"><?php echo $tax->labels->slug_field_description; ?></p></td> 173 </tr> 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 'aria_describedby' => 'parent-description', 190 ); 191 192 /** This filter is documented in wp-admin/edit-tags.php */ 193 $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' ); 194 wp_dropdown_categories( $dropdown_args ); 195 ?> 196 <?php if ( 'category' === $taxonomy ) : ?> 197 <p class="description" 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> 198 <?php else : ?> 199 <p class="description" id="parent-description"><?php echo $tax->labels->parent_field_description; ?></p> 200 <?php endif; ?> 201 </td> 202 </tr> 203 <?php endif; // is_taxonomy_hierarchical() ?> 204 <tr class="form-field term-description-wrap"> 205 <th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th> 206 <td><textarea name="description" id="description" rows="5" cols="50" class="large-text" aria-describedby="description-description"><?php echo $tag->description; // textarea_escaped ?></textarea> 207 <p class="description" id="description-description"><?php echo $tax->labels->desc_field_description; ?></p></td> 208 </tr> 209 <?php 210 // Back compat hooks. 211 if ( 'category' === $taxonomy ) { 212 /** 213 * Fires after the Edit Category form fields are displayed. 214 * 215 * @since 2.9.0 216 * @deprecated 3.0.0 Use {@see '{$taxonomy}_edit_form_fields'} instead. 217 * 218 * @param WP_Term $tag Current category term object. 219 */ 220 do_action_deprecated( 'edit_category_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' ); 221 } elseif ( 'link_category' === $taxonomy ) { 222 /** 223 * Fires after the Edit Link Category form fields are displayed. 224 * 225 * @since 2.9.0 226 * @deprecated 3.0.0 Use {@see '{$taxonomy}_edit_form_fields'} instead. 227 * 228 * @param WP_Term $tag Current link category term object. 229 */ 230 do_action_deprecated( 'edit_link_category_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' ); 231 } else { 232 /** 233 * Fires after the Edit Tag form fields are displayed. 234 * 235 * @since 2.9.0 236 * @deprecated 3.0.0 Use {@see '{$taxonomy}_edit_form_fields'} instead. 237 * 238 * @param WP_Term $tag Current tag term object. 239 */ 240 do_action_deprecated( 'edit_tag_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' ); 241 } 242 /** 243 * Fires after the Edit Term form fields are displayed. 244 * 245 * The dynamic portion of the hook name, `$taxonomy`, refers to 246 * the taxonomy slug. 247 * 248 * Possible hook names include: 249 * 250 * - `category_edit_form_fields` 251 * - `post_tag_edit_form_fields` 252 * 253 * @since 3.0.0 254 * 255 * @param WP_Term $tag Current taxonomy term object. 256 * @param string $taxonomy Current taxonomy slug. 257 */ 258 do_action( "{$taxonomy}_edit_form_fields", $tag, $taxonomy ); 259 ?> 260 </table> 261 <?php 262 // Back compat hooks. 263 if ( 'category' === $taxonomy ) { 264 /** This action is documented in wp-admin/edit-tags.php */ 265 do_action_deprecated( 'edit_category_form', array( $tag ), '3.0.0', '{$taxonomy}_add_form' ); 266 } elseif ( 'link_category' === $taxonomy ) { 267 /** This action is documented in wp-admin/edit-tags.php */ 268 do_action_deprecated( 'edit_link_category_form', array( $tag ), '3.0.0', '{$taxonomy}_add_form' ); 269 } else { 270 /** 271 * Fires at the end of the Edit Term form. 272 * 273 * @since 2.5.0 274 * @deprecated 3.0.0 Use {@see '{$taxonomy}_edit_form'} instead. 275 * 276 * @param WP_Term $tag Current taxonomy term object. 277 */ 278 do_action_deprecated( 'edit_tag_form', array( $tag ), '3.0.0', '{$taxonomy}_edit_form' ); 279 } 280 /** 281 * Fires at the end of the Edit Term form for all taxonomies. 282 * 283 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 284 * 285 * Possible hook names include: 286 * 287 * - `category_edit_form` 288 * - `post_tag_edit_form` 289 * 290 * @since 3.0.0 291 * 292 * @param WP_Term $tag Current taxonomy term object. 293 * @param string $taxonomy Current taxonomy slug. 294 */ 295 do_action( "{$taxonomy}_edit_form", $tag, $taxonomy ); 296 ?> 297 298 <div class="edit-tag-actions"> 299 300 <?php submit_button( __( 'Update' ), 'primary', null, false ); ?> 301 302 <?php if ( current_user_can( 'delete_term', $tag->term_id ) ) : ?> 303 <span id="delete-link"> 304 <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> 305 </span> 306 <?php endif; ?> 307 308 </div> 309 310 </form> 311 </div> 312 313 <?php if ( ! wp_is_mobile() ) : ?> 314 <script type="text/javascript"> 315 try{document.forms.edittag.name.focus();}catch(e){} 316 </script> 317 <?php 318 endif;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Tue Mar 19 08:20:01 2024 | Cross-referenced by PHPXref |