is_buddypress()

Is this a BuddyPress component?


Description 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 Return

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


Top ↑

Source Source

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

function is_buddypress() {
	$retval = (bool) ( bp_current_component() || bp_is_user() );

	/**
	 * Filters whether or not this is a BuddyPress component.
	 *
	 * @since 1.7.0
	 *
	 * @param bool $retval Whether or not this is a BuddyPress component.
	 */
	return apply_filters( 'is_buddypress', $retval );
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.