What the.. Where'd that redirect come from? This plugin helps to uncover redirects as they happen.
Important: It is not recommended you leave debugging enabled when you’re done, the debug information exposes file paths of files as well as PHP arguments passed into functions from the PHP debug_backtrace()
which may contain sensitive information.
This is useful for those times when you have a lot of plugins / theme functions interacting that cause an unknown redirect. This tool helps you figure out what is redirecting and where it’s redirecting at in the code.
This plugin outputs information about each wp_redirect()
and wp_safe_redirect()
call done on the front and in the admin area of a site.
You can enable redirect debugging by going to Settings > Debug wp_redirect()
on your site or in your network settings (if network activated). You have the option to enable debugging for frontend requests and/or admin dashboard requests. You also have the ability to only show debugging if the person is logged in or is an admin.
If you encounter problems with this plugin blocking redirects you need for logging in or being able to disable the redirect, simply rename the plugin or define this in your wp-config.php file: define( 'DEBUG_WP_REDIRECT', false );
You can define constants in your wp-config.php file to enable redirect handling for frontend / admin dashboard requests. Constants override any options set in the admin settings page.
define( 'DEBUG_WP_REDIRECT', true );
define( 'DEBUG_WP_REDIRECT_ADMIN', true );
define( 'DEBUG_WP_REDIRECT_LOGGED_IN_ADMIN', true );
define( 'DEBUG_WP_REDIRECT_LOGGED_IN', true );
define( 'DEBUG_WP_REDIRECT_LOGGED_IN_USER_ID', true );
You can enable/disable debugging when you have your own code you want to start/stop debugging after a certain point.
These functions will start/stop debugging the redirects whether it’s on a frontend or admin dashboard request.
debug_wp_redirect_enable()
debug_wp_redirect_disable()
Take the debug-wp-redirect.php file and add it to your mu-plugin folder in a location like: /wp-content/mu-plugins/debug-wp-redirect.php
You won’t need any other files. The admin settings page will not show up so you will need to use mu-plugin mode specifically with the constants for wp-config.php as documented above.
You can help to make this plugin better through GitHub or sponsor my time.
wp-content/plugins/
folder locallywp-admin/plugins.php
on your site (your WP Admin plugin page)OR you can just install it with WordPress by going to Plugins >> Add New >> and type this plugin’s name
is_user_logged_in()
function calls to be able to handle earlier redirect debugging.debug_wp_redirect_enable()
and debug_wp_redirect_disable()
to easily turn debugging on programmatically.DEBUG_WP_REDIRECT
is defined and set to true