Filter to change media gallery header title

You can use the filter rtmedia_gallery_title in your theme and can modify the default media gallery title “Media Gallery”under media tab. Add the following code in your theme’s functions.php file:

    function change_media_gallery_title( $title ){
        $title = 'New Media Label';
        return $title;
    }
    add_filter('rtmedia_gallery_title', 'change_media_gallery_title', 10, 1);

Where “New Media Label” will be name which you want to use.

change-media-gallery-label

Above code will change the title under all media tabs ( All, Albums, Photos etc ). If you want to add custom title for only a specific tab then you can try below code:

For Example,

1) Change title for All tab :

function change_media_gallery_title( $title ){
    global $rtmedia_query;
    if ( isset( $rtmedia_query->action_query->default ) && ! isset( $rtmedia_query->action_query->media_type ) ) {
        $title = 'New Media Label';
    }
    return $title;
}
add_filter('rtmedia_gallery_title', 'change_media_gallery_title', 10, 1);

2) Change title for Photos tab :

function change_media_gallery_title( $title ){
    global $rtmedia_query;
    if ( ! isset( $rtmedia_query->action_query->default ) && ( isset( $rtmedia_query->action_query->media_type ) && 'photo' === $rtmedia_query->action_query->media_type ) ) {
        $title = 'New Media Label';
    }
    return $title;
}
add_filter('rtmedia_gallery_title', 'change_media_gallery_title', 10, 1);

Above code will change the title for photos tab under both BuddyPress profile tab and BuddyPress group profile media tab.
If you want to add a custom title for a specific tab under media tab and exclude this custom title from BuddyPress group ( keep default title “Media Gallery” under group photos), then you can refer below code:

function change_media_gallery_title( $title ){
    global $rtmedia_query;
    if ( ! isset( $rtmedia_query->action_query->default ) && ( isset( $rtmedia_query->action_query->media_type ) && 'photo' === $rtmedia_query->action_query->media_type ) && ( isset( $rtmedia_query->query['context'] ) && 'group' != $rtmedia_query->query['context'] ) ) {
        $title = 'New Media Label';
    }
    return $title;
}
add_filter('rtmedia_gallery_title', 'change_media_gallery_title', 10, 1);