I'm trying to retrieve some data from a remote Wordpress site (to another Wordpress site), the code below returns an empty array, if I use the local database (just comment out the first line of code) it returns posts. Preferably I'd like to be able to run a WP_Query
on the remote database, but that's just a bonus.
$wpdb = new wpdb( $dbusername, $dbpassword, $dbname, $dbhost );
$wpdb->set_prefix('wp_');
$wpdb->show_errors();
$psts = $wpdb->get_row(
"SELECT * FROM $wpdb->posts"
);
EDIT:
I've discovered that if I change the query to "SELECT * FROM wp_posts"
I get a result. So I guess it's a PHP version thing (I run 5.4.4 and server runs 5.3.3)? Still can't run a WP-Query though.
EDIT 2: I just realized I've left out one important piece of information: the site I'm running the Query from is a multi site install! I'm sure this could affect they how the querys are formed!