Change text of Description in Image Library

Even if is not very flexible filter you can use the gettex hook.

Only be aware that this filter runs for every string being translated, so can affect performarce if over-used.

To narrow the performance impact you can add it only of admin footer, and remove it just after had use it:

add_action('admin_footer', function() {
  add_filter( 'gettext', 'change_caption_text', 99, 3 );
}, 9 );

function change_caption_text( $trans = NULL, $untrans = NULL, $domain = NULL ) {
  if ( $untrans === 'Caption' && $domain === 'default' ) {
    remove_filter( current_filter(), __FUNCTION__ );
    $trans = __( ':-)', 'your-domain' );
  }
  return $trans;
}

Result:

Change "Caption" label using gettext filter

Leave a Comment