Created
August 8, 2016 16:22
-
-
Save darrenjaworski/d7a380f6a3866bd08f30f661b9473a7c to your computer and use it in GitHub Desktop.
wp config database conditional
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ... An alternative to a multisite config while using the same codebase. | |
// ... In my use case: parent and child theme with two different domains. Multisite not wanted. (although it would make life easier) | |
// ** MySQL settings - You can get this info from your web host ** // | |
/** The name of the database for WordPress */ | |
$domain_one = preg_match( '/domainone\.com/', $_SERVER['SERVER_NAME'] ); | |
$domain_two = preg_match('/domaintwo\.com/', $_SERVER['SERVER_NAME'] ); | |
if ( $domain_one ) { | |
define('DB_NAME', 'database_one'); | |
} else if ( $domain_two ) { | |
define('DB_NAME', 'database_two'); | |
} | |
//... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment