Skip to content

Instantly share code, notes, and snippets.

@joshuapaling
Last active December 16, 2015 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshuapaling/5499915 to your computer and use it in GitHub Desktop.
Save joshuapaling/5499915 to your computer and use it in GitHub Desktop.
Wordpress config - live / local / staging database configs in the one file.
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
// ** MySQL settings - You can get this info from your web host ** //
switch ($_SERVER['SERVER_NAME']) {
case 'mysite.localhost':
define('DB_NAME', 'local_database_name');
define('DB_USER', 'JP');
define('DB_PASSWORD', 'XXXXXXXXXXX');
define('DB_HOST', 'localhost');
define('WP_DEBUG', false);
break;
case 'mysite.stagingdomain.com.au':
define('DB_NAME', 'staging_database_name');
define('DB_USER', 'staging_databse_user');
define('DB_PASSWORD', 'XXXXXXXXXXX');
define('DB_HOST', 'localhost');
define('WP_DEBUG', false);
break;
default:
define('DB_NAME', 'live_database_name');
define('DB_USER', 'live_database_user');
define('DB_PASSWORD', 'XXXXXXXXXXX');
define('DB_HOST', 'localhost');
define('WP_DEBUG', false);
}
// Then, remember to delete the define('WP_DEBUG', false); that exists further down in the wp-config file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment