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?
5 s
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.