PHP Fatal Error – $wpdb a non-object?

“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.