wp/wp-admin/edit-tag-form.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
     4  *
     4  *
     5  * @package WordPress
     5  * @package WordPress
     6  * @subpackage Administration
     6  * @subpackage Administration
     7  */
     7  */
     8 
     8 
     9 // don't load directly
     9 // Don't load directly.
    10 if ( ! defined( 'ABSPATH' ) ) {
    10 if ( ! defined( 'ABSPATH' ) ) {
    11 	die( '-1' );
    11 	die( '-1' );
    12 }
    12 }
    13 
    13 
    14 // Back compat hooks
    14 // Back compat hooks.
    15 if ( 'category' == $taxonomy ) {
    15 if ( 'category' === $taxonomy ) {
    16 	/**
    16 	/**
    17 	 * Fires before the Edit Category form.
    17 	 * Fires before the Edit Category form.
    18 	 *
    18 	 *
    19 	 * @since 2.1.0
    19 	 * @since 2.1.0
    20 	 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
    20 	 * @deprecated 3.0.0 Use {@see '{$taxonomy}_pre_edit_form'} instead.
    21 	 *
    21 	 *
    22 	 * @param WP_Term $tag Current category term object.
    22 	 * @param WP_Term $tag Current category term object.
    23 	 */
    23 	 */
    24 	do_action( 'edit_category_form_pre', $tag );
    24 	do_action_deprecated( 'edit_category_form_pre', array( $tag ), '3.0.0', '{$taxonomy}_pre_edit_form' );
    25 } elseif ( 'link_category' == $taxonomy ) {
    25 } elseif ( 'link_category' === $taxonomy ) {
    26 	/**
    26 	/**
    27 	 * Fires before the Edit Link Category form.
    27 	 * Fires before the Edit Link Category form.
    28 	 *
    28 	 *
    29 	 * @since 2.3.0
    29 	 * @since 2.3.0
    30 	 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
    30 	 * @deprecated 3.0.0 Use {@see '{$taxonomy}_pre_edit_form'} instead.
    31 	 *
    31 	 *
    32 	 * @param WP_Term $tag Current link category term object.
    32 	 * @param WP_Term $tag Current link category term object.
    33 	 */
    33 	 */
    34 	do_action( 'edit_link_category_form_pre', $tag );
    34 	do_action_deprecated( 'edit_link_category_form_pre', array( $tag ), '3.0.0', '{$taxonomy}_pre_edit_form' );
    35 } else {
    35 } else {
    36 	/**
    36 	/**
    37 	 * Fires before the Edit Tag form.
    37 	 * Fires before the Edit Tag form.
    38 	 *
    38 	 *
    39 	 * @since 2.5.0
    39 	 * @since 2.5.0
    40 	 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
    40 	 * @deprecated 3.0.0 Use {@see '{$taxonomy}_pre_edit_form'} instead.
    41 	 *
    41 	 *
    42 	 * @param WP_Term $tag Current tag term object.
    42 	 * @param WP_Term $tag Current tag term object.
    43 	 */
    43 	 */
    44 	do_action( 'edit_tag_form_pre', $tag );
    44 	do_action_deprecated( 'edit_tag_form_pre', array( $tag ), '3.0.0', '{$taxonomy}_pre_edit_form' );
    45 }
    45 }
    46 
    46 
    47 /**
    47 /**
    48  * Use with caution, see https://codex.wordpress.org/Function_Reference/wp_reset_vars
    48  * Use with caution, see https://developer.wordpress.org/reference/functions/wp_reset_vars/
    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
   175 
   175 
   176 				/** This filter is documented in wp-admin/edit-tags.php */
   176 				/** This filter is documented in wp-admin/edit-tags.php */
   177 				$dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' );
   177 				$dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' );
   178 				wp_dropdown_categories( $dropdown_args );
   178 				wp_dropdown_categories( $dropdown_args );
   179 				?>
   179 				?>
   180 				<?php if ( 'category' == $taxonomy ) : ?>
   180 				<?php if ( 'category' === $taxonomy ) : ?>
   181 					<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>
   181 					<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>
   182 				<?php else : ?>
   182 				<?php else : ?>
   183 					<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>
   183 					<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>
   184 				<?php endif; ?>
   184 				<?php endif; ?>
   185 			</td>
   185 			</td>
   189 			<th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th>
   189 			<th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th>
   190 			<td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $tag->description; // textarea_escaped ?></textarea>
   190 			<td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $tag->description; // textarea_escaped ?></textarea>
   191 			<p class="description"><?php _e( 'The description is not prominent by default; however, some themes may show it.' ); ?></p></td>
   191 			<p class="description"><?php _e( 'The description is not prominent by default; however, some themes may show it.' ); ?></p></td>
   192 		</tr>
   192 		</tr>
   193 		<?php
   193 		<?php
   194 		// Back compat hooks
   194 		// Back compat hooks.
   195 		if ( 'category' == $taxonomy ) {
   195 		if ( 'category' === $taxonomy ) {
   196 			/**
   196 			/**
   197 			 * Fires after the Edit Category form fields are displayed.
   197 			 * Fires after the Edit Category form fields are displayed.
   198 			 *
   198 			 *
   199 			 * @since 2.9.0
   199 			 * @since 2.9.0
   200 			 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
   200 			 * @deprecated 3.0.0 Use {@see '{$taxonomy}_edit_form_fields'} instead.
   201 			 *
   201 			 *
   202 			 * @param WP_Term $tag Current category term object.
   202 			 * @param WP_Term $tag Current category term object.
   203 			 */
   203 			 */
   204 			do_action( 'edit_category_form_fields', $tag );
   204 			do_action_deprecated( 'edit_category_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' );
   205 		} elseif ( 'link_category' == $taxonomy ) {
   205 		} elseif ( 'link_category' === $taxonomy ) {
   206 			/**
   206 			/**
   207 			 * Fires after the Edit Link Category form fields are displayed.
   207 			 * Fires after the Edit Link Category form fields are displayed.
   208 			 *
   208 			 *
   209 			 * @since 2.9.0
   209 			 * @since 2.9.0
   210 			 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
   210 			 * @deprecated 3.0.0 Use {@see '{$taxonomy}_edit_form_fields'} instead.
   211 			 *
   211 			 *
   212 			 * @param WP_Term $tag Current link category term object.
   212 			 * @param WP_Term $tag Current link category term object.
   213 			 */
   213 			 */
   214 			do_action( 'edit_link_category_form_fields', $tag );
   214 			do_action_deprecated( 'edit_link_category_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' );
   215 		} else {
   215 		} else {
   216 			/**
   216 			/**
   217 			 * Fires after the Edit Tag form fields are displayed.
   217 			 * Fires after the Edit Tag form fields are displayed.
   218 			 *
   218 			 *
   219 			 * @since 2.9.0
   219 			 * @since 2.9.0
   220 			 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
   220 			 * @deprecated 3.0.0 Use {@see '{$taxonomy}_edit_form_fields'} instead.
   221 			 *
   221 			 *
   222 			 * @param WP_Term $tag Current tag term object.
   222 			 * @param WP_Term $tag Current tag term object.
   223 			 */
   223 			 */
   224 			do_action( 'edit_tag_form_fields', $tag );
   224 			do_action_deprecated( 'edit_tag_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' );
   225 		}
   225 		}
   226 		/**
   226 		/**
   227 		 * Fires after the Edit Term form fields are displayed.
   227 		 * Fires after the Edit Term form fields are displayed.
   228 		 *
   228 		 *
   229 		 * The dynamic portion of the hook name, `$taxonomy`, refers to
   229 		 * The dynamic portion of the hook name, `$taxonomy`, refers to
   236 		 */
   236 		 */
   237 		do_action( "{$taxonomy}_edit_form_fields", $tag, $taxonomy );
   237 		do_action( "{$taxonomy}_edit_form_fields", $tag, $taxonomy );
   238 		?>
   238 		?>
   239 	</table>
   239 	</table>
   240 <?php
   240 <?php
   241 // Back compat hooks
   241 // Back compat hooks.
   242 if ( 'category' == $taxonomy ) {
   242 if ( 'category' === $taxonomy ) {
   243 	/** This action is documented in wp-admin/edit-tags.php */
   243 	/** This action is documented in wp-admin/edit-tags.php */
   244 	do_action( 'edit_category_form', $tag );
   244 	do_action_deprecated( 'edit_category_form', array( $tag ), '3.0.0', '{$taxonomy}_add_form' );
   245 } elseif ( 'link_category' == $taxonomy ) {
   245 } elseif ( 'link_category' === $taxonomy ) {
   246 	/** This action is documented in wp-admin/edit-tags.php */
   246 	/** This action is documented in wp-admin/edit-tags.php */
   247 	do_action( 'edit_link_category_form', $tag );
   247 	do_action_deprecated( 'edit_link_category_form', array( $tag ), '3.0.0', '{$taxonomy}_add_form' );
   248 } else {
   248 } else {
   249 	/**
   249 	/**
   250 	 * Fires at the end of the Edit Term form.
   250 	 * Fires at the end of the Edit Term form.
   251 	 *
   251 	 *
   252 	 * @since 2.5.0
   252 	 * @since 2.5.0
   253 	 * @deprecated 3.0.0 Use {$taxonomy}_edit_form instead.
   253 	 * @deprecated 3.0.0 Use {@see '{$taxonomy}_edit_form'} instead.
   254 	 *
   254 	 *
   255 	 * @param WP_Term $tag Current taxonomy term object.
   255 	 * @param WP_Term $tag Current taxonomy term object.
   256 	 */
   256 	 */
   257 	do_action( 'edit_tag_form', $tag );
   257 	do_action_deprecated( 'edit_tag_form', array( $tag ), '3.0.0', '{$taxonomy}_edit_form' );
   258 }
   258 }
   259 /**
   259 /**
   260  * Fires at the end of the Edit Term form for all taxonomies.
   260  * Fires at the end of the Edit Term form for all taxonomies.
   261  *
   261  *
   262  * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
   262  * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.