bp_comments_open

Force comments_status to 'closed' for BuddyPress post types.

Description

bp_comments_open( (bool) $open, (int) $post_id = 0 ); 

Parameters (2)

0. $open (bool)
True if open, false if closed.
1. $post_id — Optional. (int)
ID of the post to check.

Usage

  1. if ( !function_exists( 'bp_comments_open' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-theme-compatibility.php'; 
  3.  
  4. // True if open, false if closed. 
  5. $open = true; 
  6.  
  7. // ID of the post to check. 
  8. $post_id = -1; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bp_comments_open($open, $post_id); 
  12.  

Defined (1)

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

/bp-core/bp-core-theme-compatibility.php  
  1. function bp_comments_open( $open, $post_id = 0 ) { 
  2.  
  3. $retval = is_buddypress() ? false : $open; 
  4.  
  5. /** 
  6. * Filters whether or not to force comments_status to closed for BuddyPress post types. 
  7. * @since 1.7.0 
  8. * @param bool $retval Whether or not we are on a BuddyPress post type. 
  9. * @param bool $open True if comments open, false if closed. 
  10. * @param int $post_id Post ID for the checked post. 
  11. */ 
  12. return apply_filters( 'bp_force_comment_status', $retval, $open, $post_id );