bp_get_group_link( BP_Groups_Group|null $group = null )

Return an HTML-formatted link for the current group in the loop.

Description

Parameters

$group

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

Default value: null

Return

(string)

Source

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

1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
function bp_get_group_link( $group = null ) {
    global $groups_template;
 
    if ( empty( $group ) ) {
        $group =& $groups_template->group;
    }
 
    $link = sprintf(
        '<a href="%s" class="bp-group-home-link %s-home-link">%s</a>',
        esc_url( bp_get_group_permalink( $group ) ),
        esc_attr( bp_get_group_slug( $group ) ),
        esc_html( bp_get_group_name( $group ) )
    );
 
    /**
     * Filters the HTML-formatted link for the current group in the loop.
     *
     * @since BuddyPress 2.9.0
     *
     * @param string          $value HTML-formatted link for the
     *                               current group in the loop.
     * @param BP_Groups_Group $group The current group object.
     */
    return apply_filters( 'bp_get_group_link', $link, $group );
}

Changelog

Changelog
Version Description
BuddyPress 2.9.0 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.