[wp-hackers] $wpdb->prefix

Haluk Karamete halukkaramete at gmail.com
Sat Jun 13 02:06:05 UTC 2015


I installed 2 WordPress sites but pointed the 2nd WordPress install to the
1st one's database. Since I used a different table prefix for the 2nd one,
everything works.

This results that  I got 2 set of WordPress tables in the same database
while the 2nd one uses just a different wpdb prefix.

The question is...

How can I use the get_posts() ( or WP_Query for that matter) to query to
1st WordPress's posts from the 2nd one?

Is there an argument that I can pass to the get_posts or to WP_query to
tell the WP to use a different prefix than the current installs
wpdb->prefix default?


Ideally, this ios what I'm looking for;

$args = array(
'db_prefix' => 'xyz',
'posts_per_page' => -1,
);

Is there something like the 'db_prefix' above ?


More information about the wp-hackers mailing list