Define WP_DEBUG conditionally / for admins only / log errors (append query arg for all links?)

I don’t think there is a universal URL hook. There are a lot of hooks and I may have missed it, but I don’t think there is one. You can look through the hooks at adambrown.info. There are a lot of URL hooks, but not a universal one.

If I may suggest another solution: Log the errors to a files.

/**
 * This will log all errors notices and warnings to a file called debug.log in
 * wp-content (if Apache does not have write permission, you may need to create
 * the file first and set the appropriate permissions (i.e. use 666) ) 
 */
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors',0);

That code is straight from the Codex for the wp-config.php file. If you do that, you won’t have to worry about juggling $_GET or sorting out who is and who isn’t an admin.

Edit:

I forgot one possible solution. You can do this with Javascript. A short script could attach your parameter to all the URLs on the page, and you can pretty easily load the script only for admins.

I’d still suggest the ‘log’ solution since errors for everybody are logged. If your people are like mine and send error ‘reports’ like “hey, the site is broken when you do that form” you will appreciate the log. 🙂

Leave a Comment