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.

In wp-admin/includes/media.php I found this:

function media_buttons($editor_id = 'content') {
    $context = apply_filters('media_buttons_context', __('Upload/Insert %s'));

    $img = '<img src="' . esc_url( admin_url( 'images/media-button.png?ver=20111005' ) ) . '" width="15" height="15" />';

    echo '<a href="' . esc_url( get_upload_iframe_src() ) . '" class="thickbox add_media" id="' . esc_attr( $editor_id ) . '-add_media" title="' . esc_attr__( 'Add Media' ) . '" onclick="return false;">' . sprintf( $context, $img ) . '</a>';
}
add_action( 'media_buttons', 'media_buttons' );

I don't know what I'm doing to change the text from Upload/Insert in my functions.php file. I've tried what I have below and it doesn't work.

function adcp_change_media_button($context) {
    return str_replace('Upload/Insert %s', 'Upload/Insert images, documents, etc %s');
}
add_filter('media_buttons', 'adcp_change_media_button');

Thanks for the help!

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted
function adcp_change_media_button( $context ) 
{
    // $context acutally IS 'Upload/Insert %s', so we simply drop in in some other string
    return __( 'Upload/Insert images, documents, etc %s', 'YOUR_TEXTDOMAIN' );
}
// Then use the right filter name
add_filter( 'media_buttons_context', 'adcp_change_media_button' );
share|improve this answer
    
Thanks for the quick reply. What do I put for YOUR_TEXTDOMAIN? Just the domain? Out of curiosity, What is the purpose of it? –  kel Mar 26 '12 at 23:51
1  
It's the textdomain for your theme. You need, because else the system would search for a matching string inside the WP translation files, which would fail silently and cost time. It doesn't matter if your theme doesn't have an translation file (.po/.mo file endings - translated with POEdit - read on codex about it). –  kaiser Mar 26 '12 at 23:59
add comment

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.