Run two wordpress sites from the same database - same content

Posted on 2012-09-19
Last Modified: 2012-09-19
Hi, ive scoured the web looking for this answer but there seesm to be nothing up to date. I have a web portfolio running on wordpress which i want two themes for. I thought it would be easy to have two installs and change the theme on one. Duplicating the tables (wp_options) was easy but i have no idea how to tell the second installation to use the new table ( which points to the new folder) - I started making a tutorial to help others ( ) from the other tutorials i saw on the web, but the last step cannot be done as the code in wordpress has changed...

Anyone know an easy way to have two wordpress installations running from the same database? or is there an easier way to have switchable themes
Question by:ahimsalove
    LVL 70

    Expert Comment

    by:Jason C. Levine
    You can do this on the sly using MySQL federated tables:

    The flow would go somewhat like this:

    1) Create WP site #1 in database 1
    2) Create WP site #2 in database 2 using the same table prefix as #1 (if using prefixes)
    3) Drop all the tables in database 2 EXCEPT wp_options
    4) Run the appropriate CREATE TABLE commands using the federated storage engine per the instructions at on all of the WP tables in database 1 except wp_options.

    At the end of those steps, you would have all of the content and user and meta tables replicated on both databases but independent wp_options tables.  That should allow you to define different themes.

    Your linked article involves hacking the WP core files (specifically wp-settings.php) and anyone following it would lose all of the changes on the next WordPress update.

    Author Comment

    Thanks for the advice. How does one make federated tables... I read about them and it says they need to be on different servers? Is there an easier way to have two themes running on wordpress? seems like a lot of work for a seemingly simple task. Im still extremely new to mySql and all the fact that it all happens with commands is kind of scary.

    I read one article that said to try these two plugins - theme switcher and theme preview. Both are outdated though and i havent tried them yet. Would that be a better way to switch themes on the fly.... ?

    thanks a lot
    LVL 70

    Accepted Solution

    How does one make federated tables

    One reads the second link I provided which explains the command syntax in great detail.  You should be able to run in on the same server as long as you have different databases.  If all tables are in the same database, you're going to be forced to MySQL Table Replication and that's not a good place to be.

    Is there an easier way to have two themes running on wordpress?

    You can use a plugin but that's really meant to give a site a user-choosable skin experience and not really germane to what you are trying to do by having one database power two sites.  Check this plugin out:

    Another reason people don't spend a lot of time worrying about this is that the new Panda/Penguin rules at Google will absolutely murder both sites for posting identical content.

    Author Closing Comment

    Thanks a lot...  yes i had heard about the google thing but hadnt really factored it in that much.. Thanks for reminding me. It my personal portfolio site, so i dnt need a good google ranking, but better it play it safer... ill try the plugin and hope it goes well... thanks a lot

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and Log…
    The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: : Go t…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now