Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

My first time posting, I'm hoping someone could help me with this error that has appeared on my website as of Wednesday, I'm not sure how to correct it since I've never touched the .php file.

If I could get some help, I would be really appreciative of it.

The website with error, located at the top of the page.

The error is:

Warning: Creating default object from empty value in whitelight/functions/admin-hooks.php on line 160

Here is the code from lines 150 -170

share|improve this question
Looks like $query_context is an empty variable, and when you have $query_context->context = array();, it triggers that error because the interpreter has to assume that $query_context is an object even though it was not defined as such. – jraede Jun 21 at 23:46
add comment (requires an account with 50 reputation)

2 Answers

This probably means that your host has upgraded the server to php 5.4.x. Please reference this page on how to solve the issue: PHP 5.4: disable warning "Creating default object from empty value"

In summary, You either need have your own error handler or if this is the only place that it occurs then you just need to make it a stdClass before making it an array like so:

} // End IF Statement
$query_context = new stdClass();               
$query_context->context = array();

It is also possible that upgrading wordpress and its plugins would solve the problem. I don't know much about that area though...

share|improve this answer
add comment (requires an account with 50 reputation)

Insert this at the beginning of whitelight/functions/admin-hooks.php to disable warnings:

error_reporting(E_ERROR);
share|improve this answer
add comment (requires an account with 50 reputation)

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.