Is there a function or command that pulls the db connection info from the WP blog? I am writing a Plugin which would have to connect to the db to retrieve the info, wondering if there was one single command/function i could call which could connect. this would make the plugin portable and would work on any WP blog. is this possible?
A:
See the Interfacing with the Database docs.
You should just be able to use the global (curse you, Wordpress) variable $wpdb
in your plugin functions, ie:
global $wpdb;
//do stuff
Plugins also have a few methods for storing "options" in the database. I just found this article, it details things fairly well.
zombat
2010-04-14 22:46:15
lol one time a global var is awesome
HollerTrain
2010-04-14 22:49:48
Wordpress is all global variables unfortunately. It causes a lot of problems if you get into anything more than the simplest custom development :(
zombat
2010-04-15 00:28:26