bbp_get_topic_tag_names( int $topic_id, string $sep = ', ' )

Get topic tags for a specific topic ID

Description

Parameters

$topic_id

(Required)

$sep

(Optional)

Default value: ', '

Return

(string)

Source

File: bp-forums/topics/functions.php

function bbp_get_topic_tag_names( $topic_id = 0, $sep = ', ' ) {
	$topic_id   = bbp_get_topic_id( $topic_id );
	$topic_tags = array_filter( (array) get_the_terms( $topic_id, bbp_get_topic_tag_tax_id() ) );
	$terms      = array();
	foreach ( $topic_tags as $term ) {
		$terms[] = $term->name;
	}
	$terms = !empty( $terms ) ? implode( $sep, $terms ) : '';

	return apply_filters( 'bbp_get_topic_tags', $terms, $topic_id );
}

Changelog

Changelog
Version Description
bbPress (r4165) 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.