bbp_get_topic_tag_link

Return the link of the current tag.

Description

(string) bbp_get_topic_tag_link( (string) $tag = '' ); 

Returns (string)

Term Name

Parameters (1)

0. $tag — Optional. (string) => ''
The tag.

Usage

  1. if ( !function_exists( 'bbp_get_topic_tag_link' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/topics/template.php'; 
  3.  
  4. // The tag. 
  5. $tag = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_get_topic_tag_link($tag); 
  9.  

Defined (1)

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

/includes/topics/template.php  
  1. function bbp_get_topic_tag_link( $tag = '' ) { 
  2.  
  3. // Get the term 
  4. if ( ! empty( $tag ) ) { 
  5. $term = get_term_by( 'slug', $tag, bbp_get_topic_tag_tax_id() ); 
  6. } else { 
  7. $tag = get_query_var( 'term' ); 
  8. $term = get_queried_object(); 
  9.  
  10. // Add before and after if description exists 
  11. if ( !empty( $term->term_id ) ) { 
  12. $retval = get_term_link( $term, bbp_get_topic_tag_tax_id() ); 
  13.  
  14. // No link 
  15. } else { 
  16. $retval = ''; 
  17.  
  18. return apply_filters( 'bbp_get_topic_tag_link', $retval, $tag );