is_buddypress()

Is this a BuddyPress component?

Description

You can tell if a page is displaying BP content by whether the current_component has been defined.

Generally, we can just check to see that there’s no current component. The one exception is single user home tabs, where $bp->current_component is unset. Thus the addition of the bp_is_user() check.

Return

(bool) True if it's a BuddyPress page, false otherwise.

Source

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

2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
function is_buddypress() {
    $retval = (bool) ( bp_current_component() || bp_is_user() );
 
    /**
     * Filters whether or not this is a BuddyPress component.
     *
     * @since BuddyPress 1.7.0
     *
     * @param bool $retval Whether or not this is a BuddyPress component.
     */
    return apply_filters( 'is_buddypress', $retval );
}

Changelog

Changelog
Version Description
BuddyPress 1.7.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.