I have a developer who is accessing the wp-config file directly to get database information. I would think that WP has a better way to do this. What do you think community?
Tell me more
×
WordPress Answers is a question and answer site for
WordPress developers and administrators. It's 100% free, no registration required.
|
I am not aware of a Wordpress function to do this. But have a look at this search and replace tool: http://interconnectit.com/124/search-and-replace-for-wordpress-databases/ This achieves what you want by reading in the wp-config file and scanning through it. Have a look at the function "icit_srdb_define_find" on line 374. |
|||
|
|

$wpdbholds data on the database name, the user or password(for the db connection), so including may be the only sure way to grab that info in a reliable manner unless you're happy to hardcode that info and update it from time to time. – t31os Dec 7 '11 at 17:55