I have an old post set to private. When I visit it in a browser, Network in DevTools shows that it is endlessly redirecting to itself. I have switched off my redirect plugin, that didn't help.

I wondered if it was a canonical redirect, so I tried this in functions.php:

remove_filter('template_redirect', 'redirect_canonical');

No success, so I tried:

remove_action('template_redirect', 'wp_old_slug_redirect');

And, that has fixed it. However, I then checked for old slugs:

SELECT * FROM `wp_postmeta` WHERE `meta_key` = '_wp_old_slug'

There is no entry with the relevant post_ID?! How do I fix this one page?

  • What does the wp_old_slug_redirect function look like? Can you share the its code? Jan 31, 2020 at 10:34
  • Oh, I see! When it can't find an old slug with _find_post_by_old_slug it tries with _find_post_by_old_date and looks up _wp_old_date in the wp_postmeta - is that right?
    – dtw
    Jan 31, 2020 at 15:41


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.