I have a site that is a mix of Wordpress and other PHP pages. Can I query the other database and have the results show within Wordpress?
+2
A:
Yes you can since Wordpress is written in PHP, and PHP allows you to use whatever database you want.
Unknown
2009-08-12 20:38:10
+1
A:
Late to the party, but if you're willing to add stuff to the wp-includes/wp-db.php file you can query those other databases using the $wpdb object.
Specifically, you need to add a var:
/**
* WordPress Term Relationships table
*
* @since 2.3.0
* @access public
* @var string
*/
var $term_relationships;
and add your database name to this:
var $tables = array('users', 'usermeta', 'posts', 'categories', 'post2cat', 'comments', 'links', 'link2cat', 'options','postmeta', 'terms', 'term_taxonomy', 'term_relationships');
TimS
2009-11-22 09:55:26