Opened 10 years ago
Closed 10 years ago
#5716 closed defect (bug) (fixed)
bp_core_load_template() missing $wp_query declaration
Reported by: | SGr33n | Owned by: | r-a-y |
---|---|---|---|
Milestone: | 2.1 | Priority: | normal |
Severity: | normal | Version: | 1.5 |
Component: | Core | Keywords: | has-patch commit |
Cc: |
Description
Hi,
I don't know if this is a Google or a BuddyPress issue, but just on BuddyPress user pages, the Google Plugin report some notices:
Notice: Undefined property: WP_Query::$post in sitelocalpath/httpdocs/wp-content/plugins/google-publisher/Utils.php on line 55
Notice: Trying to get property of non-object in sitelocalpath/httpdocs/wp-content/plugins/google-publisher/Utils.php on line 55
The line code is:
if (is_page()) { global $wp_query; $template_name = get_post_meta( // The following is line 55. $wp_query->post->ID, '_wp_page_template', true); if ($template_name != 'default') { return 'customPageTemplate'; } return 'page'; }
Thanks :)
Attachments (1)
Change History (9)
#1
@
10 years ago
- Component changed from Core to Rewrite Rules
- Keywords reporter-feedback added
- Milestone changed from Awaiting Review to 2.1
#4
@
10 years ago
- Component changed from Rewrite Rules to Core
- Owner set to r-a-y
- Status changed from new to assigned
- Summary changed from BuddyPress & Official Google Publisher Plugin to Theme compatibility - Reset post issue
I think this is a theme compatibility reset post issue.
Will take a look at it.
#5
@
10 years ago
- Keywords has-patch added
- Summary changed from Theme compatibility - Reset post issue to bp_core_load_template() missing $wp_query declaration
- Version set to 1.5
This is actually not a theme compatibility issue; it's an issue with bp_core_load_template()
.
bp_core_load_template()
attempts to set some $wp_query
properties to avoid notices, but doesn't set all of them. Attached patch fixes the missed $wp_query->post
property declaration, which caused the notice that the Google Publisher plugin triggered.
Will commit this patch and do some further clean up of bp_core_load_template()
that I eluded to in ticket:5241#comment:13.
Thanks, we'll look into it and see if it's us. How exactly do we recreate this? Just activate that plugin, and then visit a BP user profile page? Anything else?