Thread Starter
goxu
(@goxu)
Could anybody help please?
This requires WP 2.1
You provide db.php
and place it in wp-content
(NOT plugins)
db.php
has something like this:
<?php
class my_wpdb extends wpdb {
function method_you_want_to_replace($foo) {
//yourcode
}
}
$wpdb = new my_wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
?>
At least, that’s how it should work in theory… this is new for 2.1
Also note that if it’s query filtering that you’re looking for, there is a new query
filter that gives you access to that (that’s in 2.1+ and 2.0.6+)
Thread Starter
goxu
(@goxu)
Thank you markjaquith for your responce.
What kind of change was made in v2.1 in order to make it work?
What I’d like to do is just changing this,
$this->select($dbname);
to,
mysql_query("SET NAMES utf8", $this->dbh);
$this->select($dbname);
in the wpdb funtion of the wp-db.php.
Could this be done differently for the older versions? Is it not possible to do it with a single plugin?
Sorry if you meant to suggest the use of query filter for this since I’m not familiar with it.
See the discussion here:
http://trac.wordpress.org/ticket/2721
Query filter doesn’t apply to you here… didn’t know what you wanted to do, so I just threw it out there.
I don’t think this can be easily done in WP 2.0.x, and I don’t think it can be done via a plugin, as you need to hook in before plugins are loaded.
Thread Starter
goxu
(@goxu)
I really appreciate it, markjaquith.