Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Diagnosing Wordpress infinite internal redirects (after installing theme / plugin / demo content)
Line 1305 in wp-includes/pluggable.php you can find;
function wp_redirect( $location, $status = 302, $x_redirect_by = 'WordPress' ) {
that is probably what executes the redirect, so just add a
to see if this is indeed the culprit.
If it is, add this before the die();
Which results in something like:
#0 wp_redirect(, 301) called at [/var/www/html/wp-includes/canonical.php:799]
#1 redirect_canonical( called at [/var/www/html/wp-includes/class-wp-hook.php:307]
#2 WP_Hook->apply_filters(, Array ([0] => )) called at [/var/www/html/wp-includes/class-wp-hook.php:331]
#3 WP_Hook->do_action(Array ([0] => )) called at [/var/www/html/wp-includes/plugin.php:474]
#4 do_action(template_redirect) called at [/var/www/html/wp-includes/template-loader.php:13]
#5 require_once(/var/www/html/wp-includes/template-loader.php) called at [/var/www/html/wp-blog-header.php:19]
#6 require(/var/www/html/wp-blog-header.php) called at [/var/www/html/index.php:17]
So now we can figure out why it tries to redirect by checking that code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment