bp_is_root_blog

Is this the root blog?.

Description

bp_is_root_blog( (int) $blog_id = 0 ); 

Parameters (1)

0. $blog_id — Optional. (int)
Default: the ID of the current blog.

Usage

  1. if ( !function_exists( 'bp_is_root_blog' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-functions.php'; 
  3.  
  4. // Optional. Default: the ID of the current blog. 
  5. $blog_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_is_root_blog($blog_id); 
  9.  

Defined (1)

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

/bp-core/bp-core-functions.php  
  1. function bp_is_root_blog( $blog_id = 0 ) { 
  2.  
  3. // Assume false. 
  4. $is_root_blog = false; 
  5.  
  6. // Use current blog if no ID is passed. 
  7. if ( empty( $blog_id ) || ! is_int( $blog_id ) ) { 
  8. $blog_id = get_current_blog_id(); 
  9.  
  10. // Compare to root blog ID. 
  11. if ( bp_get_root_blog_id() === $blog_id ) { 
  12. $is_root_blog = true; 
  13.  
  14. /** 
  15. * Filters whether or not we're on the root blog. 
  16. * @since 1.5.0 
  17. * @param bool $is_root_blog Whether or not we're on the root blog. 
  18. */ 
  19. return (bool) apply_filters( 'bp_is_root_blog', (bool) $is_root_blog );