bp_theme_compat_toggle_is_page( string $retval = '' )
Do not allow {@link comments_template()} to render during theme compatibility.
Description
When theme compatibility sets the ‘is_page’ flag to true via bp_theme_compat_reset_post(), themes that use comments_template() in their page template will run.
To prevent comments_template() from rendering, we set the ‘is_page’ and ‘is_single’ flags to false since that function looks at these conditionals before querying the database for comments and loading the comments template.
This is done during the output buffer as late as possible to prevent any wonkiness.
Parameters
- $retval
-
(Optional) The current post content.
Default value: ''
Return
(string) $retval
Source
File: bp-core/bp-core-theme-compatibility.php
function bp_theme_compat_toggle_is_page( $retval = '' ) { global $wp_query; if ( $wp_query->is_page ) { $wp_query->is_page = false; // Set a switch so we know that we've toggled these WP_Query properties. buddypress()->theme_compat->is_page_toggled = true; } return $retval; }
Changelog
Version | Description |
---|---|
BuddyPress 1.9.2 | 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.