diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index bf385880fd..12a7ffdfc5 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -20,6 +20,7 @@ class wpdb { var $last_query; var $col_info; var $queries; + var $ready = false; // Our tables var $posts; @@ -74,12 +75,14 @@ class wpdb {
If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.
"); + return; } if ( !empty($this->charset) && version_compare(mysql_get_server_info(), '4.1.0', '>=') ) $this->query("SET NAMES '$this->charset'"); $this->select($dbname); + $this->ready = true; } function __destruct() { @@ -101,6 +104,7 @@ class wpdb {If you don't know how to setup a database you should contact your host. If all else fails you may find help at the WordPress Support Forums.
"); + return; } } @@ -195,6 +199,9 @@ class wpdb { // Basic Query - see docs for more detail function query($query) { + if ( ! $ready ) + return false; + // filter the query, if filters are available // NOTE: some queries are made before the plugins have been loaded, and thus cannot be filtered with this method if ( function_exists('apply_filters') )