Created
December 11, 2015 21:06
-
-
Save zaus/9b52909f80bb01986001 to your computer and use it in GitHub Desktop.
wp-config DEBUG
This file contains hidden or 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
switch($_SERVER['HTTP_HOST']) { | |
case 'wp.sandbox:81': | |
define('DB_NAME', 'YOURDB');/** The name of the database for WordPress */ | |
define('DB_USER', 'YOURUSER');/** MySQL database username */ | |
define('DB_PASSWORD', 'YOURPASS');/** MySQL database password */ | |
define('DB_HOST', 'localhost');/** MySQL hostname */ // may need to use actual computer ip in some cases | |
break; | |
default: | |
define('DB_NAME', 'YOURDB');/** The name of the database for WordPress */ | |
define('DB_USER', 'YOURUSER');/** MySQL database username */ | |
define('DB_PASSWORD', 'YOURPASS');/** MySQL database password */ | |
define('DB_HOST', 'localhost');/** MySQL hostname */ // may need to use actual computer ip in some cases | |
break; | |
} | |
/** Database Charset to use in creating database tables. */ | |
define('DB_CHARSET', 'utf8mb4'); | |
/** The Database Collate type. Don't change this if in doubt. */ | |
define('DB_COLLATE', ''); |
This file contains hidden or 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
define('WP_DEBUG', true); | |
define('WP_DEBUG_LOG', true); | |
define('WP_DEBUG_DISPLAY', false); | |
// http://fuelyourcoding.com/simple-debugging-with-wordpress/ | |
if(!function_exists('_log')): | |
function _log( $message ) { | |
$message = func_get_args(); | |
if( WP_DEBUG !== true ) return; | |
$e = new Exception(); | |
$backtrace = str_replace(getcwd(), '', $e->getTraceAsString()); | |
// do we print the whole backtrace? or just the first line | |
if($message[0] !== 'backtrace') $backtrace = explode("\n"/*PHP_EOL*/, $backtrace)[0]; | |
error_log(sprintf('DEBUG AT: %s%s%s' | |
, $backtrace | |
, PHP_EOL | |
, print_r( count($message) == 1 ? $message[0] : $message, true ) | |
)); | |
} | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment