Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
wp-config DEBUG
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', '');
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
You can’t perform that action at this time.