Skip to content

Instantly share code, notes, and snippets.

@shimondoodkin
Last active December 11, 2015 10:58
Show Gist options
  • Save shimondoodkin/4590653 to your computer and use it in GitHub Desktop.
Save shimondoodkin/4590653 to your computer and use it in GitHub Desktop.
helps debug canonical url wordpress - replace all wp_redirect function calls with calls to exit_redirect function
...
function exit_redirect($url,$status){ //wp_redirect
//return wp_redirect($url,$status); // uncomment to temporarly disable
while(ob_get_level())ob_end_flush();
if ( !$requested_url ) {
// build the URL in the address bar
$requested_url = is_ssl() ? 'https://' : 'http://';
$requested_url .= $_SERVER['HTTP_HOST'];
$requested_url .= $_SERVER['REQUEST_URI'];
}
echo "<xmp>";
debug_print_backtrace();
echo "\r\n";
echo $url;
echo "\r\n";
echo $requested_url;
echo "\r\n";
echo "</xmp>";
exit();
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment