0

I'm getting many Fatal errors like this in Wordpress 3.6.1, multisite with Buddypress:

PHP Fatal error: Call to a member function suppress_errors() on a non-object in /myblog/wproot/wp-includes/option.php on line 143

The non-object referred to is the global value $wpdb, in the line:

$suppress = $wpdb->suppress_errors();

which is in the function wp_load_alloptions()

Any ideas why $wpdb would not be set, and if there is anything to be done to remedy this? Sorry I don't have any more useful on this, the errors are isolated and don't show a stack trace.

1 Answer 1

3

"the errors (…) don't show a stack trace" - they would if you were using xdebug.

It means $wpdb is not loaded yet, not loaded properly, or gone:

  • If you added code that calls it to your wp-config file or something to that order, remove it.
  • If you've a db.php file in wp-content, it's probably broken so rename it.
  • If you're messing around with things on a shutdown handler, do them earlier on the shutdown hook instead.
1
  • Thanks, I have xdebug on my dev server, but unfortunately can't reproduce these errors there. I will look into your third suggestion, though if that's the case it will be in a third party plugin.
    – Lemmy
    Commented Nov 20, 2013 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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