bp_get_forum_topic_tag_list

Get the current topic's tag list.

Description

bp_get_forum_topic_tag_list( (string) $format = 'string' ); 

Parameters (1)

0. $format — Optional. (string) => 'string'
'string' returns comma-separated string; otherwise returns array.

Usage

  1. if ( !function_exists( 'bp_get_forum_topic_tag_list' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bp-forums-template.php'; 
  3.  
  4. // 'string' returns comma-separated string; 
  5. // otherwise returns array. 
  6. $format = 'string'; 
  7.  
  8. // NOTICE! Understand what this does before running. 
  9. $result = bp_get_forum_topic_tag_list($format); 
  10.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bp-forums-template.php  
  1. function bp_get_forum_topic_tag_list( $format = 'string' ) { 
  2. global $topic_template; 
  3.  
  4. $tags_data = !empty( $topic_template->topic_tags ) ? $topic_template->topic_tags : false; 
  5.  
  6. $tags = array(); 
  7.  
  8. if ( $tags_data ) { 
  9. foreach( $tags_data as $tag_data ) { 
  10. $tags[] = $tag_data->name; 
  11.  
  12. if ( 'string' == $format ) 
  13. $tags = implode( ', ', $tags ); 
  14.  
  15. /** 
  16. * Filters the current topic's tag list. 
  17. * @since 1.5.0 
  18. * @param string|array $tags List or array of tags for the current topic. 
  19. * @param string $format Requested format for the tags. 
  20. */ 
  21. return apply_filters( 'bp_forum_topic_tag_list', $tags, $format );