Skip to main content
Copy edited (e.g. ref. <http://english.stackexchange.com/questions/4645/is-it-ever-correct-to-have-a-space-before-a-qu#comment206109_4645> and <https://en.wikipedia.org/wiki/Uniform_resource_locator>). Made compliant with the Jon Skeet Decree - <twitter.com/PeterMortensen/status/976400000942034944>.
Source Link

Enable Error Debugging And Logging To Use On Live Sites

This is a piece of code I wrote to make use of the WP_DEBUG constants that are normally disabled by default. Well, I created a way to not only enable WP_DEBUG so you can use it on a live site with no negative side-effects, but I also made use of the other debugging constants for forcing errors to be displayed, and for creating a log file of the errors and Notices in the /wp-content directory.

Drop this code in your wp-config.php file ( AFTERAFTER YOU SAVE A BACKUP JUST IN CASE  ) and then you can pass the ?debug=1, 2, or 3 parameters at the end of any urlURL on your site.

?debug=1 = shows all errors/notices ?debug=2 = forces them to be displayed ?debug=3 = creates a debug.log file of all errors in /wp-content dir.

/** * Written by Jared Williams - http://new2wp.com * @wp-config.php replace WP_DEBUG constant with this code * Enable WP debugging for usage on a live site * http://core.trac.wordpress.org/browser/trunk/wp-includes/load.php#L230 * Pass the '?debug=#' parameter at the end of any urlURL on site * * http://example.com/?debug=1, /?debug=2, /?debug=3 */ if ( isset($_GET['debug']) && $_GET['debug'] == '1' ) { // enableEnable the reporting of notices during development - E_ALL define('WP_DEBUG', true); } elseif ( isset($_GET['debug']) && $_GET['debug'] == '2' ) { // mustMust be true for WP_DEBUG_DISPLAY to work define('WP_DEBUG', true); // forceForce the display of errors define('WP_DEBUG_DISPLAY', true); } elseif ( isset($_GET['debug']) && $_GET['debug'] == '3' ) { // mustMust be true for WP_DEBUG_LOG to work define('WP_DEBUG', true); // logLog errors to debug.log in the wp-content directory define('WP_DEBUG_LOG', true); } 

I go into more detail on the guest post I wrote for Comluv if you're interested, here: http://comluv.com/dev/enable-debugging-and-logging-for-live-site-usage/

I'm still working on a way to make this either password protected, or preferrably somehow make it work on if (current_user_can('manage_themes') and is_logged_in().

But that's where it gets alot more tricky.

Enable Error Debugging And Logging To Use On Live Sites

This is a piece of code I wrote to make use of the WP_DEBUG constants that are normally disabled by default. Well I created a way to not only enable WP_DEBUG so you can use it on a live site with no negative side-effects, but I also made use of the other debugging constants for forcing errors to be displayed, and for creating a log file of the errors and Notices in the /wp-content directory.

Drop this code in your wp-config.php file ( AFTER YOU SAVE A BACKUP JUST IN CASE  ) and then you can pass the ?debug=1, 2, or 3 parameters at the end of any url on your site.

?debug=1 = shows all errors/notices ?debug=2 = forces them to be displayed ?debug=3 = creates a debug.log file of all errors in /wp-content dir.

/** * Written by Jared Williams - http://new2wp.com * @wp-config.php replace WP_DEBUG constant with this code * Enable WP debugging for usage on a live site * http://core.trac.wordpress.org/browser/trunk/wp-includes/load.php#L230 * Pass the '?debug=#' parameter at the end of any url on site * * http://example.com/?debug=1, /?debug=2, /?debug=3 */ if ( isset($_GET['debug']) && $_GET['debug'] == '1' ) { // enable the reporting of notices during development - E_ALL define('WP_DEBUG', true); } elseif ( isset($_GET['debug']) && $_GET['debug'] == '2' ) { // must be true for WP_DEBUG_DISPLAY to work define('WP_DEBUG', true); // force the display of errors define('WP_DEBUG_DISPLAY', true); } elseif ( isset($_GET['debug']) && $_GET['debug'] == '3' ) { // must be true for WP_DEBUG_LOG to work define('WP_DEBUG', true); // log errors to debug.log in the wp-content directory define('WP_DEBUG_LOG', true); } 

I go into more detail on the guest post I wrote for Comluv if you're interested, here: http://comluv.com/dev/enable-debugging-and-logging-for-live-site-usage/

I'm still working on a way to make this either password protected, or preferrably somehow make it work on if (current_user_can('manage_themes') and is_logged_in().

But that's where it gets alot more tricky.

Enable Error Debugging And Logging To Use On Live Sites

This is a piece of code I wrote to make use of the WP_DEBUG constants that are normally disabled by default. Well, I created a way to not only enable WP_DEBUG so you can use it on a live site with no negative side-effects, but I also made use of the other debugging constants for forcing errors to be displayed, and for creating a log file of the errors and Notices in the /wp-content directory.

Drop this code in your wp-config.php file (AFTER YOU SAVE A BACKUP JUST IN CASE) and then you can pass the ?debug=1, 2, or 3 parameters at the end of any URL on your site.

?debug=1 = shows all errors/notices ?debug=2 = forces them to be displayed ?debug=3 = creates a debug.log file of all errors in /wp-content dir.

/** * Written by Jared Williams - http://new2wp.com * @wp-config.php replace WP_DEBUG constant with this code * Enable WP debugging for usage on a live site * http://core.trac.wordpress.org/browser/trunk/wp-includes/load.php#L230 * Pass the '?debug=#' parameter at the end of any URL on site * * http://example.com/?debug=1, /?debug=2, /?debug=3 */ if ( isset($_GET['debug']) && $_GET['debug'] == '1' ) { // Enable the reporting of notices during development - E_ALL define('WP_DEBUG', true); } elseif ( isset($_GET['debug']) && $_GET['debug'] == '2' ) { // Must be true for WP_DEBUG_DISPLAY to work define('WP_DEBUG', true); // Force the display of errors define('WP_DEBUG_DISPLAY', true); } elseif ( isset($_GET['debug']) && $_GET['debug'] == '3' ) { // Must be true for WP_DEBUG_LOG to work define('WP_DEBUG', true); // Log errors to debug.log in the wp-content directory define('WP_DEBUG_LOG', true); } 

I go into more detail on the guest post I wrote for Comluv if you're interested, here: http://comluv.com/dev/enable-debugging-and-logging-for-live-site-usage/

I'm still working on a way to make this either password protected, or preferrably somehow make it work on if (current_user_can('manage_themes') and is_logged_in().

But that's where it gets alot more tricky.

Source Link
jaredwilli
  • 841
  • 1
  • 12
  • 24

Enable Error Debugging And Logging To Use On Live Sites

This is a piece of code I wrote to make use of the WP_DEBUG constants that are normally disabled by default. Well I created a way to not only enable WP_DEBUG so you can use it on a live site with no negative side-effects, but I also made use of the other debugging constants for forcing errors to be displayed, and for creating a log file of the errors and Notices in the /wp-content directory.

Drop this code in your wp-config.php file ( AFTER YOU SAVE A BACKUP JUST IN CASE ) and then you can pass the ?debug=1, 2, or 3 parameters at the end of any url on your site.

?debug=1 = shows all errors/notices ?debug=2 = forces them to be displayed ?debug=3 = creates a debug.log file of all errors in /wp-content dir.

/** * Written by Jared Williams - http://new2wp.com * @wp-config.php replace WP_DEBUG constant with this code * Enable WP debugging for usage on a live site * http://core.trac.wordpress.org/browser/trunk/wp-includes/load.php#L230 * Pass the '?debug=#' parameter at the end of any url on site * * http://example.com/?debug=1, /?debug=2, /?debug=3 */ if ( isset($_GET['debug']) && $_GET['debug'] == '1' ) { // enable the reporting of notices during development - E_ALL define('WP_DEBUG', true); } elseif ( isset($_GET['debug']) && $_GET['debug'] == '2' ) { // must be true for WP_DEBUG_DISPLAY to work define('WP_DEBUG', true); // force the display of errors define('WP_DEBUG_DISPLAY', true); } elseif ( isset($_GET['debug']) && $_GET['debug'] == '3' ) { // must be true for WP_DEBUG_LOG to work define('WP_DEBUG', true); // log errors to debug.log in the wp-content directory define('WP_DEBUG_LOG', true); } 

I go into more detail on the guest post I wrote for Comluv if you're interested, here: http://comluv.com/dev/enable-debugging-and-logging-for-live-site-usage/

I'm still working on a way to make this either password protected, or preferrably somehow make it work on if (current_user_can('manage_themes') and is_logged_in().

But that's where it gets alot more tricky.

Post Made Community Wiki