Skip to content

Instantly share code, notes, and snippets.

@Gumster
Created June 28, 2019 13:03
Show Gist options
  • Save Gumster/d8c1ca48f4e008d9d983befe6c30b54c to your computer and use it in GitHub Desktop.
Save Gumster/d8c1ca48f4e008d9d983befe6c30b54c to your computer and use it in GitHub Desktop.
Wordpress environment
/**
* Add file local-config.php with the following:
*
* define('DB_NAME', '');
* define('DB_USER', '');
* define('DB_PASSWORD', '');
* define('DB_HOST', '');
* define('WP_DEBUG', true);
* define('SCRIPT_DEBUG', true);
*
* And add the below to start of wp-config.php...
*/
// Work out domain dynamically
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$wp_host = empty($_SERVER['HTTP_HOST']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
$wp_home = $protocol.$wp_host;
$wp_siteurl = $wp_home;
// and whaaammmy
define('WP_HOME', $wp_home);
define('WP_SITEURL', $wp_siteurl);
/**
* Use local db connection settings if defined in file
*/
if (file_exists(dirname(__FILE__) . '/local-config.php')) {
include(dirname(__FILE__) . '/local-config.php');
define('WP_LOCAL_DEV', true);
} else {
define('WP_LOCAL_DEV', false);
define('DB_NAME', '');
define('DB_USER', '');
define('DB_PASSWORD', '');
define('DB_HOST', '');
#define('FORCE_SSL_ADMIN', true);
}
/**
* Defines for WPLANG, DB_CHARSET, DB_COLLATE follow...
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment