Actualy the question says it all. I integrated a media upload box to my admin page and a button with the text 'Insert into post' makes no sense. I rather like to change it to something like 'Use this image'. Anyone got a clue on how you are able to do so?

add_filter("attribute_escape", "myfunction", 10, 2);
function myfunction($safe_text, $text) {
    return str_replace("Insert into Post", "Use this image", $text);

Place in your theme functions file of in a plugin file.

The first usable filter that this button hits is on the function esc_attr(). So what that code will do is find any instance of Insert into Post that is run through esc_attr() and replace it to Use this image. This code might have undesired issues elsewhere though. Maybe there is a language file method someone might know of that might be a better solution than this.


add_filter("attribute_escape", "myfunction", 10, 2);
function myfunction($safe_text, $text) {
    return str_replace(__('Insert into Post'), __('Use this image'), $text);

Should account for translations.

  • I put this in my plugin, however when the media uploader is triggered by a button it will still show 'Insert into post' =/ – Mark Feb 9 '12 at 16:46
  • Insert into post or Insert into Post notice the difference – Brady Feb 9 '12 at 16:51
  • Ah I discovered the flaw. I have a dutch version of WordPress, in the attribute_escape the sentence is already translated so it could not find the Insert into post string. – Mark Feb 9 '12 at 16:57
  • @Mark have a look at my update – Brady Feb 9 '12 at 17:00
  • Then one last question. It's logic that it will also change the text on the media box of the post and page where Insert into Post does make sense how can I avoid that from happening? – Mark Feb 9 '12 at 17:05

With WordPress 3.5+ Media Uploader, there's another way. All strings are localized at the bottom of the page with:

<script type='text/javascript'>
/* <![CDATA[ */
var _wpMediaViewsL10n = {
    "addMedia":"Add Media",
    "selected":"%d selected",
    "dragInfo":"Drag and drop to reorder images.",
    "uploadFilesTitle":"Upload Files",
    "uploadImagesTitle":"Upload Images",
    "mediaLibraryTitle":"Media Library",
    "insertMediaTitle":"Insert Media",
    "createNewGallery":"Create a new gallery",
    "returnToLibrary":"\u2190 Return to library",
    "allMediaItems":"All media items",
    "noItemsFound":"No items found.",
    "insertIntoPost":"Insert into post",
    "uploadedToThisPost":"Uploaded to this post",
    // ET CETERA
/* ]]> */

On document.ready, we modify the object:

add_action('admin_footer', function()
    <script type="text/javascript">
        // or without jQuery: http://stackoverflow.com/q/799981
        jQuery(document).ready( function($) {
            _wpMediaViewsL10n.insertIntoPost = 'Gotchya!';
  • 1
    Should be the accepted answer it works great! – Christina Dec 24 '15 at 4:41

Filter 'gettext', take care to catch the target string only by checking the text domain. See this answer for a rather verbose example.

A simplified way:

add_filter( 'gettext', 'wpse_41767_change_image_button', 10, 3 );

function wpse_41767_change_image_button( $translation, $text, $domain )
    if ( 'default' == $domain and 'Insert into Post' == $text )
        // Once is enough.
        remove_filter( 'gettext', 'wpse_41767_change_image_button' );
        return 'Use this image';
    return $translation;

This is the only way to avoid false positives. A plugin author may use the same string in another location, so you have to verify the text domain.


WARNING: using the hook "attribute_escape" is kinda bad. This function is called for ALL text including post titles and content. Using this filter as stated in the accepted answer breaks html entity encoding.

For instance the title Features & Pricing appears as Features & Pricing in the title field. After saving it then shows Features &amp; Pricing. After saving again you get Features &amp;amp; Pricing.

A better alternative might be to use jquery to change the button text.

add_action( 'admin_head', 'admin_head_script' );
function admin_head_script()
        $('input[value="Insert into Post"]').val('Use this Image');

or via CSS

.your-media-frame .media-button-insert{
.your-media-frame .media-button-insert:before{
    content:'Insert image';

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.