I'm trying to access a second database with my wordpress system. To do this, I've attempted to follow the advice found here which seems to have worked for a lot of people.
In summary, I'm adding the following line to my functions.php:
global $newdb;
$newdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
$newdb->show_errors();
Unfortunately, when I add this I come up with the following error:
Fatal error: Class 'wpdb' not found in /home/mine/www/wp-includes/functions.php
I'm sure I must be missing wrong (obviously, right?) but the instructions don't seem to have any extra steps that I've been leaving out.
Thanks for any help
DB_USER
,DB_PASSWORD
, etc) alldefine
d somewhere? Are you callingnew wpdb()
in a filter or action, or just bare in thefunctions.php
file?