bb_get_topic_tags

Bb_get_topic_tags() - Returns all of the bb_topic_tags associated with the specified topic.

Description

(array|false) bb_get_topic_tags( (int) $topic_id = 0, (null) $args = null ); 

Returns (array|false)

Term objects (back-compat), false on failure

Parameters (2)

0. $topic_id — Optional. (int)
The topic id.
1. $args — Optional. (null) => null
The args.

Usage

  1. if ( !function_exists( 'bb_get_topic_tags' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-topic-tags.php'; 
  3.  
  4. // The topic id. 
  5. $topic_id = -1; 
  6.  
  7. // The args. 
  8. $args = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bb_get_topic_tags($topic_id, $args); 
  12.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-topic-tags.php  
  1. function bb_get_topic_tags( $topic_id = 0, $args = null ) { 
  2. global $wp_taxonomy_object; 
  3.  
  4. if ( !$topic = get_topic( get_topic_id( $topic_id ) ) ) 
  5. return false; 
  6.  
  7. $topic_id = (int) $topic->topic_id; 
  8.  
  9. $cache_id = $topic_id . serialize( $args ); 
  10.  
  11. $terms = wp_cache_get( $cache_id, 'bb_topic_tag_terms' ); 
  12. if ( false === $terms ) { 
  13. $terms = $wp_taxonomy_object->get_object_terms( (int) $topic->topic_id, 'bb_topic_tag', $args ); 
  14. wp_cache_set( $cache_id, $terms, 'bb_topic_tag_terms' ); 
  15.  
  16. if ( is_wp_error( $terms ) ) 
  17. return false; 
  18.  
  19. for ( $i = 0; isset($terms[$i]); $i++ ) 
  20. _bb_make_tag_compat( $terms[$i] ); 
  21.  
  22. return $terms;