Feature Suggestion to Debug "pre-redirect"
-
I came up with the following hook to be able to debug issues prior to a wp_redirect and view the pre-redirect output when something goes wrong there.
Just sharing the method I use right now, to perhaps include it as feature. I use a WP_DEBUG_REDIRECT constant in wp_setting.php to turn it on and off.
But it would be good to have a checkbox in “Debug Objects Settings” for that…//filter to temporarily get a “debug object” prior to redirecting with a backtrace
if (WP_DEBUG && WP_DEBUG_REDIRECT) {
add_filter(‘wp_redirect’, ‘wp_redirect_debug’,1,2);
function wp_redirect_debug($location,$status){
require_once( ‘./admin-header.php’ );//render admin panels
debug_print_backtrace();
require_once( ‘./admin-footer.php’ );//footer with debugs
return false;
} // Cancel the redirect
}
- The topic ‘Feature Suggestion to Debug "pre-redirect"’ is closed to new replies.