Make WordPress Core

Changeset 62683


Ignore:
Timestamp:
07/09/2026 09:16:36 PM (4 weeks ago)
Author:
joedolson
Message:

Media: Update labels for media caption inputs.

All media types used the label Caption for the data stored in $post->post_excerpt. This label is only meaningful for image media types, and misrepresents the content for video and audio, where caption has a different specific meaning.

Change the labels to use Image Caption for the image case, and Short Description for all other cases, so that the label represents the explicit usage where core uses the data, and represents the internal storage model for cases where core does not use the data.

Props postphotos, bridgetwillard, kirasong, joemcgill, afercia, pento, karmatosed, desrosj, jamesbregenzer, abcd95, aperto, joedolson.
Fixes #43178.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/media.php

    r62494 r62683  
    32753275
    32763276                <p>
    3277                         <label for="attachment_caption"><strong><?php _e( 'Caption' ); ?></strong></label><br />
     3277                        <label for="attachment_caption"><strong>
     3278                                <?php
     3279                                if ( wp_attachment_is( 'image', $post ) ) {
     3280                                        esc_html_e( 'Image Caption' );
     3281                                } else {
     3282                                        esc_html_e( 'Short Description' );
     3283                                }
     3284                                ?>
     3285                        </strong></label><br />
    32783286                        <textarea class="widefat" name="excerpt" id="attachment_caption"><?php echo $post->post_excerpt; ?></textarea>
    32793287                </p>
  • trunk/src/wp-includes/media-template.php

    r62428 r62683  
    545545                                <# } #>
    546546                                <span class="setting" data-setting="caption">
    547                                         <label for="attachment-details-two-column-caption" class="name"><?php _e( 'Caption' ); ?></label>
     547                                        <# if ( 'image' === data.type ) { #>
     548                                        <label for="attachment-details-two-column-caption" class="name"><?php esc_html_e( 'Image Caption' ); ?></label>
     549                                        <# } else { #>
     550                                        <label for="attachment-details-two-column-caption" class="name"><?php esc_html_e( 'Short Description' ); ?></label>
     551                                        <# } #>
    548552                                        <textarea id="attachment-details-two-column-caption" {{ maybeReadOnly }}>{{ data.caption }}</textarea>
    549553                                </span>
     
    797801                <# } #>
    798802                <span class="setting" data-setting="caption">
    799                         <label for="attachment-details-caption" class="name"><?php _e( 'Caption' ); ?></label>
     803                        <# if ( 'image' === data.type ) { #>
     804                        <label for="attachment-details-caption" class="name"><?php esc_html_e( 'Image Caption' ); ?></label>
     805                        <# } else { #>
     806                        <label for="attachment-details-caption" class="name"><?php esc_html_e( 'Short Description' ); ?></label>
     807                        <# } #>
    800808                        <textarea id="attachment-details-caption" {{ maybeReadOnly }}>{{ data.caption }}</textarea>
    801809                </span>
Note: See TracChangeset for help on using the changeset viewer.