[wp-hackers] $wpdb->prefix

Christian Wach needle at haystack.co.uk
Sat Jun 13 10:10:55 UTC 2015


Sounds to me like you should host both sites in a multisite instance.

Cheers,

Christian


On 13 Jun 2015, at 03:06, Haluk Karamete <halukkaramete at gmail.com> wrote:

> 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 ?
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list