Skip to content

Commit cec8718

Browse files
committed
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. git-svn-id: https://develop.svn.wordpress.org/trunk@62683 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 0527680 commit cec8718

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

src/wp-admin/includes/media.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3274,7 +3274,15 @@ function edit_form_image_editor( $post ) {
32743274
<?php endif; ?>
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>
32803288

src/wp-includes/media-template.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,11 @@ function wp_print_media_templates() {
544544
<?php endforeach; ?>
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>
550554
<span class="setting" data-setting="description">
@@ -796,7 +800,11 @@ function wp_print_media_templates() {
796800
<?php endforeach; ?>
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>
802810
<span class="setting" data-setting="description">

0 commit comments

Comments
 (0)