3

i would like to change or add text to the Media Library Overlay on the right side if you click on an image and can enter a description for the image. At the moment there stands "Description" or "Caption" (German Version installed).

See Image here: enter image description here

2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.