views:

156

answers:

2

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
+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