Last active
October 30, 2019 19:34
-
-
Save ahmu83/ee6467b66ab1509c6ae9b77d151d0797 to your computer and use it in GitHub Desktop.
LOCAL & PRODUCTION specific variables for a wordpress instance
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 | |
/** | |
* @author Ahmad Karim <hello@ahmadkarim.com> | |
* | |
* DEV & PROD specific variables | |
* for WordPress when working with | |
* LOCAL & LIVE instances at the same time | |
*/ | |
$localhosts = array('127.0.0.1', '::1'); | |
$env = in_array($_SERVER['REMOTE_ADDR'], $localhosts) ? 'DEV' : 'PROD'; | |
/** | |
* DB Credentials for DEV & PROD | |
*/ | |
$DBs = array(); | |
$DBs['DEV'] = array( | |
'NAME' => 'db_name', | |
'USER' => 'db_user', | |
'PASS' => 'db_pass', | |
'HOST' => 'localhost', | |
'PREFIX' => 'wp_', | |
'CHARSET' => 'utf8mb4', | |
'COLLATE' => '', | |
); | |
$DBs['PROD'] = array( | |
'NAME' => 'db_name', | |
'USER' => 'db_user', | |
'PASS' => 'db_pass', | |
'HOST' => 'localhost', | |
'PREFIX' => 'wp_', | |
'CHARSET' => 'utf8mb4', | |
'COLLATE' => '', | |
); | |
$DB = $DBs[$env]; | |
/** | |
* URLs for DEV & PROD | |
*/ | |
$URLs = array(); | |
$URLs['DEV'] = array( | |
'HOME' => 'http://instance-url.com.test', | |
'SITEURL' => 'http://instance-url.com.test', | |
); | |
$URLs['PROD'] = array( | |
'HOME' => 'https://instance-url.com', | |
'SITEURL' => 'https://instance-url.com', | |
); | |
$URL = $URLs[$env]; | |
/** | |
* WP_DEBUG value for DEV & PROD | |
*/ | |
$DEBUG = ($env == 'DEV' ? true : false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment