Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to rename the "Add Media" button (just above the post editor interface) to be "Add Images". I can't seem to find the appropriate filter for this. There seems to be a filter that has now been deprecated but I can't figure out what the new method is. The legacy filter was media_buttons_context.

share|improve this question
1  
I'm curious, why? You're aware it's possible to add video, sound, PDFs, etc? –  Tom J Nowell Apr 8 '13 at 15:49

1 Answer 1

up vote 6 down vote accepted

The button text being a translatable string, you can make use of the gettext filter:

function wpse95025_rename_media_button( $translation, $text ) {
    if( is_admin() && 'Add Media' === $text ) {
        return 'Add Images';
    }
    return $translation;
}
add_filter( 'gettext', wpse95025_rename_media_button, 10, 2 );

For the sake of completeness:
Of course, you can also keep the new string translatable.

function wpse95025_rename_media_button( $translation, $text ) {
    if( is_admin() && 'Add Media' === $text ) {
        return __( 'Add Images', 'your-text-domain' );
    }
    return $translation;
}
add_filter( 'gettext', wpse95025_rename_media_button, 10, 2 );
share|improve this answer
    
Thanks very much. I wasn't familiar with that filter. Appreciate the response. –  Peter Willis III Apr 8 '13 at 15:39
1  
If this solved you're issue, @Peter (which I am confident it did), be so kind as to tick the checkmark to the left of the answer to mark your question as answered, such that others can tell that it is in the future. –  Johannes Pille Apr 8 '13 at 15:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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