Rename the insert button in media upload window

I think, this is not so easy possible, on the media-page in Admin-area is it not possible to check the post_type of your CPT. Normaly you can change strings with the follow small source, an example.

if ( is_admin() )
    add_filter( 'gettext', array( 'fb_string_translate', 'gettext_filter' ), 10, 1 );
class fb_string_translate {

    static function gettext_filter( $str ) {

        $from_to = array();

        $post_type = get_post_type();
        if ( 'my_post_type' === $post_type )
            $from_to = array( 'Insert into Post' => 'Insert into Test' );

        return strtr($str, $from_to);
    }

}

But it is important, that you check, on wich page is the author in admin and on the iframe of the media page it is not possible to read the post_type; maybe you find this var and then it is possible with the example source.

Leave a Comment

error code: 523