wp/wp-admin/edit-tag-form.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    49  */
    49  */
    50 wp_reset_vars( array( 'wp_http_referer' ) );
    50 wp_reset_vars( array( 'wp_http_referer' ) );
    51 
    51 
    52 $wp_http_referer = remove_query_arg( array( 'action', 'message', 'tag_ID' ), $wp_http_referer );
    52 $wp_http_referer = remove_query_arg( array( 'action', 'message', 'tag_ID' ), $wp_http_referer );
    53 
    53 
    54 /** Also used by Edit Tags */
    54 // Also used by Edit Tags.
    55 require_once ABSPATH . 'wp-admin/includes/edit-tag-messages.php';
    55 require_once ABSPATH . 'wp-admin/includes/edit-tag-messages.php';
    56 
    56 
    57 /**
    57 /**
    58  * Fires before the Edit Term form for all taxonomies.
    58  * Fires before the Edit Term form for all taxonomies.
    59  *
    59  *
    60  * The dynamic portion of the hook name, `$taxonomy`, refers to
    60  * The dynamic portion of the hook name, `$taxonomy`, refers to
    61  * the taxonomy slug.
    61  * the taxonomy slug.
       
    62  *
       
    63  * Possible hook names include:
       
    64  *
       
    65  *  - `category_pre_edit_form`
       
    66  *  - `post_tag_pre_edit_form`
    62  *
    67  *
    63  * @since 3.0.0
    68  * @since 3.0.0
    64  *
    69  *
    65  * @param WP_Term $tag      Current taxonomy term object.
    70  * @param WP_Term $tag      Current taxonomy term object.
    66  * @param string  $taxonomy Current $taxonomy slug.
    71  * @param string  $taxonomy Current $taxonomy slug.
    94 /**
    99 /**
    95  * Fires inside the Edit Term form tag.
   100  * Fires inside the Edit Term form tag.
    96  *
   101  *
    97  * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
   102  * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
    98  *
   103  *
       
   104  * Possible hook names include:
       
   105  *
       
   106  *  - `category_term_edit_form_tag`
       
   107  *  - `post_tag_term_edit_form_tag`
       
   108  *
    99  * @since 3.7.0
   109  * @since 3.7.0
   100  */
   110  */
   101 do_action( "{$taxonomy}_term_edit_form_tag" );
   111 do_action( "{$taxonomy}_term_edit_form_tag" );
   102 ?>
   112 ?>
   103 >
   113 >
   104 <input type="hidden" name="action" value="editedtag"/>
   114 <input type="hidden" name="action" value="editedtag" />
   105 <input type="hidden" name="tag_ID" value="<?php echo esc_attr( $tag_ID ); ?>"/>
   115 <input type="hidden" name="tag_ID" value="<?php echo esc_attr( $tag_ID ); ?>" />
   106 <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>"/>
   116 <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" />
   107 <?php
   117 <?php
   108 wp_original_referer_field( true, 'previous' );
   118 wp_original_referer_field( true, 'previous' );
   109 wp_nonce_field( 'update-tag_' . $tag_ID );
   119 wp_nonce_field( 'update-tag_' . $tag_ID );
   110 
   120 
   111 /**
   121 /**
   112  * Fires at the beginning of the Edit Term form.
   122  * Fires at the beginning of the Edit Term form.
   113  *
   123  *
   114  * At this point, the required hidden fields and nonces have already been output.
   124  * At this point, the required hidden fields and nonces have already been output.
   115  *
   125  *
   116  * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
   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`
   117  *
   132  *
   118  * @since 4.5.0
   133  * @since 4.5.0
   119  *
   134  *
   120  * @param WP_Term $tag      Current taxonomy term object.
   135  * @param WP_Term $tag      Current taxonomy term object.
   121  * @param string  $taxonomy Current $taxonomy slug.
   136  * @param string  $taxonomy Current $taxonomy slug.
   136 <?php if ( ! global_terms_enabled() ) { ?>
   151 <?php if ( ! global_terms_enabled() ) { ?>
   137 		<tr class="form-field term-slug-wrap">
   152 		<tr class="form-field term-slug-wrap">
   138 			<th scope="row"><label for="slug"><?php _e( 'Slug' ); ?></label></th>
   153 			<th scope="row"><label for="slug"><?php _e( 'Slug' ); ?></label></th>
   139 			<?php
   154 			<?php
   140 			/**
   155 			/**
   141 			 * Filters the editable slug.
   156 			 * Filters the editable slug for a post or term.
   142 			 *
   157 			 *
   143 			 * Note: This is a multi-use hook in that it is leveraged both for editable
   158 			 * Note: This is a multi-use hook in that it is leveraged both for editable
   144 			 * post URIs and term slugs.
   159 			 * post URIs and term slugs.
   145 			 *
   160 			 *
   146 			 * @since 2.6.0
   161 			 * @since 2.6.0
   147 			 * @since 4.4.0 The `$tag` parameter was added.
   162 			 * @since 4.4.0 The `$tag` parameter was added.
   148 			 *
   163 			 *
   149 			 * @param string          $slug The editable slug. Will be either a term slug or post URI depending
   164 			 * @param string          $slug The editable slug. Will be either a term slug or post URI depending
   150 			 *                              upon the context in which it is evaluated.
   165 			 *                              upon the context in which it is evaluated.
   151 			 * @param WP_Term|WP_Post $tag  Term or WP_Post object.
   166 			 * @param WP_Term|WP_Post $tag  Term or post object.
   152 			 */
   167 			 */
   153 			$slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : '';
   168 			$slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : '';
   154 			?>
   169 			?>
   155 			<td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" />
   170 			<td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" />
   156 			<p class="description"><?php _e( 'The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ); ?></p></td>
   171 			<p class="description"><?php _e( 'The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ); ?></p></td>
   227 		 * Fires after the Edit Term form fields are displayed.
   242 		 * Fires after the Edit Term form fields are displayed.
   228 		 *
   243 		 *
   229 		 * The dynamic portion of the hook name, `$taxonomy`, refers to
   244 		 * The dynamic portion of the hook name, `$taxonomy`, refers to
   230 		 * the taxonomy slug.
   245 		 * the taxonomy slug.
   231 		 *
   246 		 *
       
   247 		 * Possible hook names include:
       
   248 		 *
       
   249 		 *  - `category_edit_form_fields`
       
   250 		 *  - `post_tag_edit_form_fields`
       
   251 		 *
   232 		 * @since 3.0.0
   252 		 * @since 3.0.0
   233 		 *
   253 		 *
   234 		 * @param WP_Term $tag      Current taxonomy term object.
   254 		 * @param WP_Term $tag      Current taxonomy term object.
   235 		 * @param string  $taxonomy Current taxonomy slug.
   255 		 * @param string  $taxonomy Current taxonomy slug.
   236 		 */
   256 		 */
   259 /**
   279 /**
   260  * Fires at the end of the Edit Term form for all taxonomies.
   280  * Fires at the end of the Edit Term form for all taxonomies.
   261  *
   281  *
   262  * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
   282  * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
   263  *
   283  *
       
   284  * Possible hook names include:
       
   285  *
       
   286  *  - `category_edit_form`
       
   287  *  - `post_tag_edit_form`
       
   288  *
   264  * @since 3.0.0
   289  * @since 3.0.0
   265  *
   290  *
   266  * @param WP_Term $tag      Current taxonomy term object.
   291  * @param WP_Term $tag      Current taxonomy term object.
   267  * @param string  $taxonomy Current taxonomy slug.
   292  * @param string  $taxonomy Current taxonomy slug.
   268  */
   293  */
   273 
   298 
   274 	<?php submit_button( __( 'Update' ), 'primary', null, false ); ?>
   299 	<?php submit_button( __( 'Update' ), 'primary', null, false ); ?>
   275 
   300 
   276 	<?php if ( current_user_can( 'delete_term', $tag->term_id ) ) : ?>
   301 	<?php if ( current_user_can( 'delete_term', $tag->term_id ) ) : ?>
   277 		<span id="delete-link">
   302 		<span id="delete-link">
   278 			<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>
   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>
   279 		</span>
   304 		</span>
   280 	<?php endif; ?>
   305 	<?php endif; ?>
   281 
   306 
   282 </div>
   307 </div>
   283 
   308