bp_theme_compat_toggle_is_page( string $retval = '' )

Do not allow {@link comments_template()} to render during theme compatibility.


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

$retval

(Optional) The current post content.

Default value: ''


Top ↑

Return Return

(string) $retval


Top ↑

Source 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;
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.9.2 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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