Opened 8 years ago
Closed 8 years ago
#7253 closed defect (bug) (fixed)
On cleanup, theme compat sets `is_page` to true even if it wasn't to begin with
Reported by: | boonebgorges | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 2.7 | Priority: | normal |
Severity: | normal | Version: | 1.9.2 |
Component: | Core | Keywords: | has-patch 2nd-opinion |
Cc: |
Description
During the normal theme compat process, BuddyPress hijacks the content of a WP page to display its own content. Within the_content()
, BP needs is_page()
to be false, so it sets $wp_query->is_page
to false. At the end of the loop, it resets this value to true
. This works fine during a regular BP page load, because in this case, is_page
will always be true
when the loop starts.
However, if you manage to use theme compat in a non-page context (it can be done!!), things break a bit. Specifically, if a plugin uses theme compat on, say, a post-type archive, then bp_theme_compat_loop_end()
will set is_page
to true at the end of the loop, which results in errors for code that runs after the loop is finished.
This should be fixable by only setting the is_page_toggled
flag when, in fact, is_page
is actually toggled. I don't see any harm in this, but I'd like a sanity check before continuing with it.
See 7253.diff