Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Debugging WordPress things.
*
* All of this belongs in your wp-config.php file.
*
* This will make sure that the code you release is, at a minimum,
* relatively free of PHP notices and warnings.
*
* - WP_DEBUG: This turns on debugging mode.
* @link http://codex.wordpress.org/Debugging_in_WordPress#WP_DEBUG
* - SCRIPT_DEBUG: Use the development scripts that have been shipped with
* WordPress, not the minimized and concatenated scripts. This helps with
* easier script readability and debugging. There are also cases when a
* minified or concatenated scripts triggers an issue, but the development
* version of the script does not. Toggling this will help you figure out what's
* going on when scripts seem not to be going your way.
* @link http://codex.wordpress.org/Debugging_in_WordPress#SCRIPT_DEBUG
* - WP_DEBUG_DISPLAY: Don't display debug output inside the HTML of your page. You
* can certainly keep this turned on, but if you're running a site in production
* and also want to run your site in debugging mode at the same time, then you do
* not want those messages popping up for site visitors. If you're in a development
* environment, then turning this off or on doesn't matter as much as making sure
* that you're logging errors somewhere to be able to see them.
* @link http://codex.wordpress.org/Debugging_in_WordPress#WP_DEBUG_DISPLAY
* - WP_DEBUG_LOG: This will save all errors into a file called debug.log, which is
* located in wp-content/debug.log. This is the most overlooked, most useful constant
* when it comes to debugging. Because your eyes cannot see an error doesn't mean that
* something bad isn't happening on your site. My advice is to turn off debug display,
* log the debugging to debug.log, and always keep a window open in your code editor
* that has the file debug.log open and in plain view. When you're coding, flip between
* the files that you're working on and debug.log often to make sure that things are okay.
* The most common errors are those that are very simple to fix, things like making
* sure that variables are set before checking their values, and things like
* not passing enough arguments to a hook.
* @link http://codex.wordpress.org/Debugging_in_WordPress#WP_DEBUG_LOG
* - JETPACK_DEV_DEBUG: Put Jetpack into development mode so that you don't rely
* on a connection to WordPress.com to use Jetpack in localhost or on a production site.
* @link http://jetpack.me/2013/03/28/jetpack-dev-mode-release/
* - SAVEQUERIES: I don't use this often, but I should.
* @link: http://codex.wordpress.org/Debugging_in_WordPress#SAVEQUERIES
*/
define('WP_DEBUG', true);
define('SCRIPT_DEBUG', true);
define('WP_DEBUG_DISPLAY', false);
define('WP_DEBUG_LOG',true);
define('JETPACK_DEV_DEBUG', 'true');
/**
* Sometimes on localhost there seem to be memory issues.
* These may or may not help you. I use them, but if you find that
* running WordPress on localhost is fine, and you don't run into memory issues,
* then you'll probably be able to safely ignore this.
* @link http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP
*/
define('WP_MEMORY_LIMIT', '1000M');
define('WP_MAX_MEMORY_LIMIT', '2000M');
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.