bbp_is_forum

Check if current page is a bbPress forum.

Description

bbp_is_forum( (int) $post_id = 0 ); 

Parameters (1)

0. $post_id — Optional. (int)
Possible post_id to check

Usage

  1. if ( !function_exists( 'bbp_is_forum' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/common/template.php'; 
  3.  
  4. // Possible post_id to check 
  5. $post_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_is_forum($post_id); 
  9.  

Defined (1)

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

/includes/common/template.php  
  1. function bbp_is_forum( $post_id = 0 ) { 
  2.  
  3. // Assume false 
  4. $retval = false; 
  5.  
  6. // Supplied ID is a forum 
  7. if ( !empty( $post_id ) && ( bbp_get_forum_post_type() === get_post_type( $post_id ) ) ) 
  8. $retval = true; 
  9.  
  10. return (bool) apply_filters( 'bbp_is_forum', $retval, $post_id );