bbp_get_forum_permalink

Return the link to the forum.

Description

(string) bbp_get_forum_permalink( (int) $forum_id = 0, (string) $redirect_to = '' ); 

Returns (string)

Permanent link to forum

Parameters (2)

0. $forum_id — Optional. (int)
Forum id
1. $redirect_to — Optional. (string) => ''
$redirect_to Optional. Pass a redirect value for use with shortcodes and other fun things.

Usage

  1. if ( !function_exists( 'bbp_get_forum_permalink' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/forums/template.php'; 
  3.  
  4. // Optional. Forum id 
  5. $forum_id = -1; 
  6.  
  7. // $redirect_to Optional. Pass a redirect value for use with 
  8. // shortcodes and other fun things. 
  9. $redirect_to = ''; 
  10.  
  11. // NOTICE! Understand what this does before running. 
  12. $result = bbp_get_forum_permalink($forum_id, $redirect_to); 
  13.  

Defined (1)

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

/includes/forums/template.php  
  1. function bbp_get_forum_permalink( $forum_id = 0, $redirect_to = '' ) { 
  2. $forum_id = bbp_get_forum_id( $forum_id ); 
  3.  
  4. // Use the redirect address 
  5. if ( !empty( $redirect_to ) ) { 
  6. $forum_permalink = esc_url_raw( $redirect_to ); 
  7.  
  8. // Use the topic permalink 
  9. } else { 
  10. $forum_permalink = get_permalink( $forum_id ); 
  11.  
  12. return apply_filters( 'bbp_get_forum_permalink', $forum_permalink, $forum_id );