Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Debugging WordPress
* 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
* - 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
* - 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
* - 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
* - JETPACK_DEV_DEBUG: Put Jetpack into development mode so that you don't rely
* on a connection to to use Jetpack in localhost or on a production site.
* @link
* - SAVEQUERIES: I don't use this often, but I should.
* @link:
define('WP_DEBUG', true);
define('SCRIPT_DEBUG', true);
define('WP_DEBUG_DISPLAY', false);
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
define('WP_MEMORY_LIMIT', '1000M');
define('WP_MAX_MEMORY_LIMIT', '2000M');

This comment has been minimized.

Copy link

@dauidus dauidus commented Jun 16, 2014

LOVE the Jetpack dev debug mode! I'm trying this right now.


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.