bp_get_group_cover_url( object|bool $group = false )

Returns the group cover image URL.

Description

Parameters

$group

(Optional) Group object. Default current group in loop.

Default value: false

Return

(string) The cover image URL or empty string if not found.

Source

File: bp-groups/bp-groups-template.php

1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
function bp_get_group_cover_url( $group = false ) {
    $group_id = bp_get_group_id( $group );
 
    if ( ! $group_id ) {
        return '';
    }
 
    $cover_url = bp_attachments_get_attachment(
        'url',
        array(
            'object_dir' => 'groups',
            'item_id'    => $group_id,
        )
    );
 
    if ( ! $cover_url ) {
        return '';
    }
 
    return $cover_url;
}

Changelog

Changelog
Version Description
BuddyPress 5.0.0 BuddyPress 5.0.0
BuddyBoss 1.3.5 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.