bp_get_group_cover_url( object|bool $group = false )

Returns the group cover image URL.


Parameters Parameters

$group

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

Default value: false


Top ↑

Return Return

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


Source Source

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

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;
}


Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.