How can you change the ‘Insert into Post’ title in the media button?

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.

TRY:

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.

Leave a Comment