bp_is_root_blog( int $blog_id )

Is this the root blog?

Description

Parameters

$blog_id

(Optional) Default: the ID of the current blog.

Return

(bool) $is_root_blog Returns true if this is bp_get_root_blog_id().

Source

File: bp-core/bp-core-functions.php

1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
function bp_is_root_blog( $blog_id = 0 ) {
 
    // Assume false.
    $is_root_blog = false;
 
    // Use current blog if no ID is passed.
    if ( empty( $blog_id ) || ! is_int( $blog_id ) ) {
        $blog_id = get_current_blog_id();
    }
 
    // Compare to root blog ID.
    if ( bp_get_root_blog_id() === $blog_id ) {
        $is_root_blog = true;
    }
 
    /**
     * Filters whether or not we're on the root blog.
     *
     * @since BuddyPress 1.5.0
     *
     * @param bool $is_root_blog Whether or not we're on the root blog.
     */
    return (bool) apply_filters( 'bp_is_root_blog', (bool) $is_root_blog );
}

Changelog

Changelog
Version Description
BuddyPress 1.5.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.