[wp-hackers] Two wordpress sites but one wordpress DB

Simon Vart simon.vart at exigences.biz
Fri May 17 11:18:04 UTC 2013


I do that sometimes for having différents langages.

I just use wp-config.php to use a different prefix database according to
domail url.

I can send details if you're interested.

With some little more adjustements, I also share users table so the
WordPress installs use the same logins.
Le 16 mai 2013 22:31, "Haluk Karamete" <halukkaramete at gmail.com> a écrit :

> I would like to explore the possibilities of a installing a new wordpress
> installation which will be tapping into the same database as the first one.
>
> The new site will obviously be identical in terms of content but I may
> choose to install different plugins, use different themes on the second
> one.
>
> Of course, wp_options table will be my deal breaker here. but I'm sure
> there are work arounds this matter.
>
> So I searched the matter and found this post, but before I explore the
> suggested route I wanted to check with you guys to see if this is the way
> to go or not?
>
> Thank you
>
> Here is the suggestion.
>
> <quote>
>
> I've done this before, having 6 websites shoot out content from the same
> database.
>
> It's easy enough to do. Upload WP into both directories. Make sure they
> have the identical wp-config.php file.
>
> In the second sites directory do the following:
> In the wp-settings.php file change the options database value to something
> like this:
>
> // Table names
> $wpdb->posts = $table_prefix . 'posts';
> $wpdb->users = $table_prefix . 'users';
> $wpdb->categories = $table_prefix . 'categories';
> $wpdb->post2cat = $table_prefix . 'post2cat';
> $wpdb->comments = $table_prefix . 'comments';
> $wpdb->links = $table_prefix . 'links';
> $wpdb->linkcategories = $table_prefix . 'linkcategories';
> $wpdb->options = 'YOURNEWPREFIX_options';
> $wpdb->postmeta = $table_prefix . 'postmeta';
> $wpdb->usermeta = $table_prefix . 'usermeta';
>
> $wpdb->prefix = $table_prefix;
>
> See how I've removed $table_prefix . in the options line?
> Instead of YOURNEWPREFIX put something like 'site2' or whatever you want.
>
> Then, in PHPmyAdmin duplicate the wp_options table, and rename one of the
> them to be YOURNEWPREFIX_options, so if you chose 'site2', it would be
> 'site2_options'.
>
> Bingo. Edit the information in the 'site2_options' table to refelct the
> correct information for your second site and you will be on your way.
> <quote>
> _______________________________________________
> 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