Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Warning: Creating default object from empty value in [...]/wp-content/themes/sakura/functions.php on line 802 WordPress

  • SOLVED

Hi,
i have updated wordpress version of my site to the last and then i have updated all active plugins. Actually in the blog i receive this error message in all articles:

Warning: Creating default object from empty value in [...]/wp-content/themes/sakura/functions.php on line 802.

Can someone help me to fix it?

Answers (6)

2017-06-21

Rempty answers:

what is the code of the line 802 in functions.php?


Rempty comments:

Do you still need help?
can you share the code of the line 802??


mothernatur3s0n comments:

Sorry for delay in to the answer but i started to talk with Arnav via email and they disappear. This the line code from 798 to 830

foreach ($tumblog_array as $location_item) { (LINE 798)
$tumblog_id = get_term_by( 'name', $location_item, 'tumblog' );

if( !isset($tumblog_id->term_id) ) {
$tumblog_id->term_id = null;
}

if ( $tumblog_items['articles'] == $tumblog_id->term_id && !$sentinel ) {
$tumblog_results = 'text';
$sentinel = true;
} elseif ($tumblog_items['images'] == $tumblog_id->term_id && !$sentinel ) {
$tumblog_results = 'image';
$sentinel = true;
} elseif ($tumblog_items['audio'] == $tumblog_id->term_id && !$sentinel) {
$tumblog_results = 'audio';
$sentinel = true;
} elseif ($tumblog_items['video'] == $tumblog_id->term_id && !$sentinel) {
$tumblog_results = 'video';
$sentinel = true;
} elseif ($tumblog_items['quotes'] == $tumblog_id->term_id && !$sentinel) {
$tumblog_results = 'quote';
$sentinel = true;
} elseif ($tumblog_items['links'] == $tumblog_id->term_id && !$sentinel) {
$tumblog_results = 'link';
$sentinel = true;
} else {
$tumblog_results = 'text';
$sentinel = false;
}
}
return $tumblog_results;
} (LINE 729)


The line 802 is this:

$tumblog_id->term_id = null;


Rempty comments:

before line 802 add
$tumblog_id = new stdClass();

so the code will look like

if( !isset($tumblog_id->term_id) ) {
$tumblog_id = new stdClass();
$tumblog_id->term_id = null;
}

2017-06-21

Cesar Contreras answers:

What code do you have in that line of your functions.php file?

Make sure WP_DEBUG is set to false in your wp-config.php:
define('WP_DEBUG', false);

ini_set( 'display_errors', 0 );

If it is not solved can you show me that code snippet or contact me at [email protected] I'm available to work on your problem

2017-06-22

Arnav Joy answers:

what you have done is not permanent solution, it only hides the warning but there could be places where some problem may present because of this problem.
so you should get this actual problem corrected rather then hiding it.


mothernatur3s0n comments:

Hi Arnav, nice to see you again, i have already worked with you in the past and your helps was every important. Well what's your permanent solution?


Arnav Joy comments:

I will have to check it directly in your site and then I can see what's the problem and how much time it will take to correct it.
please send me mail at : [email protected]


mothernatur3s0n comments:

Because of a bad experience, I do not enter anybody anymore in the site. We will have to use Teamviewer, I want to be sure of what is being done.


mothernatur3s0n comments:

You disappear. Just tell me if your interested to help me or not.

2017-06-21

Sébastien | French WordpressDesigner answers:

and what is the content of this line ?

2017-06-21

mothernatur3s0n answers:

Sorry, untill waiting tha someone answer me, i have already fixed from myself the problem, i think correctly. I just entered in file wp-config.php and added this code line under "define('WP_DEBUG', false);":

ini_set( 'display_errors', 0 );

Now the error dont appears anymore.


Cesar Contreras comments:

Great, congratulations to solve your problem, we sometimes neglect the small details that cause us problems.


mothernatur3s0n comments:

Thanks for your comment, i appreciate it!


Rempty comments:

You didn't solve the problem, just hide the error being printed.


Cesar Contreras comments:

I think if you solved the problem, because it is only a warning saying "Create default object from the empty value".
It is not an Error, everything will be fine.

The solution would be to not initialize the empty object, but if it hid the errors other warnings will be displayed.

2017-06-22

Krishna Tiwari answers:

Hi,
Make sure WP_DEBUG is set to false in your wp-config.php:
define('WP_DEBUG', false);

ini_set( 'display_errors', 0 );

Regards,
Krishna Kumar Tiwari


mothernatur3s0n comments:

This is the solution I found myself, maybe you did not read my intervent. Thanks anyway for the answer.