Is it possible for two separate blogs running on the same multisite installation to share tables in the database?

By default, Wordpress adds the blog ID to the table prefix for all of the associated tables such that blog #1's posts are stored in the wp_1_posts table, blog #2's posts in the wp_2_posts table etc..

However, for my peculiar development workflow I would like to use blog #1 for public use and blog #2 for development while sharing database tables between them such that any changes made to either blog are reflected on both immediately (i.e. both blog #1 and blog #2's posts are stored in wp_1_posts, their users in wp_1_users, and so forth).

Any ideas?

  • 2
    But this way when you make changes to your development site you will also change the public site
    – Bainternet
    Commented Jul 24, 2011 at 16:29
  • 2
    I'm quite sure I've seen a plugin that cross-posts in MS environment, but can't find it right now... And I think it's really not advisable to go the "shared tables" way...
    – brasofilo
    Commented Apr 8, 2012 at 20:26

1 Answer 1


You can switch back and forth between blogs on a multisite with switch_to_blog and restore_current_blog.

That should allow you to get anything you'd like and make queries as if you were actually on the other blog.

Check them out: http://codex.wordpress.org/WPMU_Functions/switch_to_blog http://codex.wordpress.org/WPMU_Functions/restore_current_blog

We did a lot of this with one of our recent sites.

  • ...sorry this took 2 years to answer. Commented Jan 19, 2014 at 4:39
  • I created my own solution at the time, but this one could be useful. Since no one else has answered, ill give the check to you. Commented Jan 19, 2014 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.