Make WordPress Core

Ticket #52724: 52724.diff

File 52724.diff, 6.2 KB (added by dingo_d, 3 years ago)

Added new filters for the labels

  • src/wp-admin/edit-tag-form.php

    diff --git a/src/wp-admin/edit-tag-form.php b/src/wp-admin/edit-tag-form.php
    index 5e6ae119ac..1e81a528bc 100644
    a b $tag_name_value = ''; 
    126126if ( isset( $tag->name ) ) {
    127127        $tag_name_value = esc_attr( $tag->name );
    128128}
     129
     130/**
     131 * Filters the label of the taxonomy term name
     132 *
     133 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     134 *
     135 * @since 5.8
     136 *
     137 * @param string $name_label The label string to replace.
     138 */
     139$term_name_label = apply_filters( "{$taxonomy}_term_name_label", _x( 'Name', 'term name' ) );
     140
     141/**
     142 * Filters the info description of the taxonomy term name
     143 *
     144 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     145 *
     146 * @since 5.8
     147 *
     148 * @param string $description The label string to replace.
     149 */
     150$term_name_info = apply_filters( "{$taxonomy}_term_name_info", __( 'The name is how it appears on your site.' ) );
    129151?>
    130152        <table class="form-table" role="presentation">
    131153                <tr class="form-field form-required term-name-wrap">
    132                         <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th>
     154                        <th scope="row"><label for="name"><?php echo $term_name_label; ?></label></th>
    133155                        <td><input name="name" id="name" type="text" value="<?php echo $tag_name_value; ?>" size="40" aria-required="true" />
    134                         <p class="description"><?php _e( 'The name is how it appears on your site.' ); ?></p></td>
     156                        <p class="description"><?php echo $term_name_info; ?></p></td>
    135157                </tr>
    136158<?php if ( ! global_terms_enabled() ) { ?>
    137159                <tr class="form-field term-slug-wrap">
    if ( isset( $tag->name ) ) { 
    184206                                <?php endif; ?>
    185207                        </td>
    186208                </tr>
    187 <?php endif; // is_taxonomy_hierarchical() ?>
     209<?php endif; // is_taxonomy_hierarchical()
     210
     211/**
     212 * Filters the label of the taxonomy term description
     213 *
     214 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     215 *
     216 * @since 5.8
     217 *
     218 * @param string $name_label The label string to replace.
     219 */
     220$term_description_label = apply_filters( "{$taxonomy}_term_description_label", __( 'Description' ) );
     221
     222/**
     223 * Filters the info description of the taxonomy term name
     224 *
     225 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     226 *
     227 * @since 5.8
     228 *
     229 * @param string $description The label string to replace.
     230 */
     231$term_description_info = apply_filters( "{$taxonomy}_term_description_info", __( 'The description is not prominent by default; however, some themes may show it.' ) );
     232?>
    188233                <tr class="form-field term-description-wrap">
    189                         <th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th>
     234                        <th scope="row"><label for="description"><?php echo $term_description_label; ?></label></th>
    190235                        <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>
     236                        <p class="description"><?php echo $term_description_info; ?></p></td>
    192237                </tr>
    193238                <?php
    194239                // Back compat hooks.
  • src/wp-admin/edit-tags.php

    diff --git a/src/wp-admin/edit-tags.php b/src/wp-admin/edit-tags.php
    index cd35a1b326..5db4ef5b1a 100644
    a b if ( $can_edit_terms ) { 
    441441<input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" />
    442442        <?php wp_nonce_field( 'add-tag', '_wpnonce_add-tag' ); ?>
    443443
     444<?php
     445/**
     446 * Filters the label of the taxonomy term name
     447 *
     448 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     449 *
     450 * @since 5.8
     451 *
     452 * @param string $name_label The label string to replace.
     453 */
     454$term_name_label = apply_filters( "{$taxonomy}_term_name_label", _x( 'Name', 'term name' ) );
     455
     456/**
     457 * Filters the info description of the taxonomy term name
     458 *
     459 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     460 *
     461 * @since 5.8
     462 *
     463 * @param string $description The label string to replace.
     464 */
     465$term_name_info = apply_filters( "{$taxonomy}_term_name_info", __( 'The name is how it appears on your site.' ) );
     466?>
    444467<div class="form-field form-required term-name-wrap">
    445         <label for="tag-name"><?php _ex( 'Name', 'term name' ); ?></label>
     468        <label for="tag-name"><?php echo $term_name_label; ?></label>
    446469        <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" />
    447         <p><?php _e( 'The name is how it appears on your site.' ); ?></p>
     470        <p><?php echo $term_name_info; ?></p>
    448471</div>
    449472        <?php if ( ! global_terms_enabled() ) : ?>
    450473<div class="form-field term-slug-wrap">
    if ( $can_edit_terms ) { 
    498521                <p><?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>
    499522        <?php endif; ?>
    500523</div>
    501         <?php endif; // is_taxonomy_hierarchical() ?>
     524        <?php endif; // is_taxonomy_hierarchical()
     525
     526        /**
     527         * Filters the label of the taxonomy term description
     528         *
     529         * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     530         *
     531         * @since 5.8
     532         *
     533         * @param string $name_label The label string to replace.
     534         */
     535        $term_description_label = apply_filters( "{$taxonomy}_term_description_label", __( 'Description' ) );
     536
     537        /**
     538         * Filters the info description of the taxonomy term name
     539         *
     540         * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     541         *
     542         * @since 5.8
     543         *
     544         * @param string $description The label string to replace.
     545         */
     546        $term_description_info = apply_filters( "{$taxonomy}_term_description_info", __( 'The description is not prominent by default; however, some themes may show it.' ) );
     547
     548        ?>
    502549<div class="form-field term-description-wrap">
    503         <label for="tag-description"><?php _e( 'Description' ); ?></label>
     550        <label for="tag-description"><?php echo $term_description_label; ?></label>
    504551        <textarea name="description" id="tag-description" rows="5" cols="40"></textarea>
    505         <p><?php _e( 'The description is not prominent by default; however, some themes may show it.' ); ?></p>
     552        <p><?php echo $term_description_info; ?></p>
    506553</div>
    507554
    508555        <?php