Error in Buddypress Profile

Solved4.42K viewsIssues
0

Not sure why, but I’m getting an error at the top of my answer/question links in the Buddypress Profile pages… Other than that, the plugin seems to function properly.

This is the error…

Warning: Creating default object from empty value in /home1/gotcalmo/public_html/wp-content/plugins/anspress-question-answer/includes/class-theme.php on line 230

Thanks.

1

I did some research and was able to fix it I believe… It removes the errror and it is not by turning off one of the E-STRICT items in your php…

From what I read it has to do with new PHP rules needing to add a new std class to instantiate an object…

so it throws the warning… on the new PHP… old PHP you could code that way…

 

so here is the fix that worked for me… Goto that line of code on 230 and replace it with this

adding this code here:

$wp_query->queried_object = new stdClass();


above line 230...

which is this code:
$wp_query->queried_object->post_title = ap_page_title();

 

	 * Remove some unwanted things from wp_head
	 */
	public function remove_head_items($WP) {
		global $wp_query;
		if ( is_anspress() ) {
			remove_action( 'wp_head', 'rsd_link' );
			remove_action( 'wp_head', 'wlwmanifest_link' );
			remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
			remove_action( 'wp_head', 'rel_canonical' );
			remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
			remove_action( 'wp_head', 'feed_links_extra', 3 );
			remove_action( 'wp_head', 'feed_links', 2 );
			$wp_query->queried_object = new stdClass();
			$wp_query->queried_object->post_title = ap_page_title();
		}
	}

 

It worked for me…  Hope it helps

Thank you for letting us know, I will check and add it to AnsPress.