bb_add_topic_tag

Bb_add_topic_tag() - Adds a single tag to a topic.

Description

(int|bool) bb_add_topic_tag( (int) $topic_id, (string) $tag ); 

Returns (int|bool)

The TT_ID of the new bb_topic_tag or false on failure

Parameters (2)

0. $topic_id (int)
The topic id.
1. $tag (string)
The (unsanitized) full name of the tag to be added

Usage

  1. if ( !function_exists( 'bb_add_topic_tag' ) ) { 
  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 (unsanitized) full name of the tag to be added 
  8. $tag = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bb_add_topic_tag($topic_id, $tag); 
  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_add_topic_tag( $topic_id, $tag ) { 
  2. $tt_ids = bb_add_topic_tags( $topic_id, $tag ); 
  3. if ( is_array( $tt_ids ) ) 
  4. return $tt_ids[0]; 
  5. return false;