bp_is_blog_page()
Is this a blog page, ie a non-BP page?
Description
You can tell if a page is displaying BP content by whether the current_component has been defined.
Return
(bool) True if it's a non-BP page, false otherwise.
Source
File: bp-core/bp-core-template.php
function bp_is_blog_page() {
$is_blog_page = false;
// 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.
if ( ! bp_current_component() && ! bp_is_user() ) {
$is_blog_page = true;
}
/**
* Filters whether or not current page is a blog page or not.
*
* @since BuddyPress 1.5.0
*
* @param bool $is_blog_page Whether or not current page is a blog page.
*/
return (bool) apply_filters( 'bp_is_blog_page', $is_blog_page );
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 1.0.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.