Multiple WordPress sites share same database

In some cases, we need to create other website using the same database for conditionally purposes. Let says, we do have, but we also need a different spesific site for Facebook Page Or you might need touch site (with swipe capabilty), like

After googling, here’s the tricks I found. 🙂

  1. Create a new WordPress site with subdomain (eg:
  2. Copy wp-config.php from main website to your subdomain site, and add this
    This will forced this new site to keep the domain as
  3. Now, how to make this new site use spesific template. Add this to your functions.php
    add_filter('template', 'change_theme');
    add_filter('option_template', 'change_theme');
    add_filter('option_stylesheet', 'change_theme');
    function change_theme()
    // return the name of theme (theme directory name)
    return 'yourspesifictheme';

Now you have another spesific site, but still using the same database.

Oops, before I forgot… You also need to add meta tag ‘noindex, nofollow’ in your header, to avoid duplicate content in term of SEO. 🙂

Categorised in:

This post was written by Sunaryo Hadi

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.