• Hey Guys,

    I have worked on this for an hour plus with absolutely no luck. Basically, one of our editors made the error of putting the wrong slug. This slug previously belonged to a category. We are using Yoast’s SEO plugin to remove the /category/ base. So due to the conflict, WordPress changed the category slug to /link25-2/. Now we changed the slug of the post which allowed us to make the category slug back to /link25/. However, the category URL redirects to the post.

    I went in wp_postmeta table and deleted the value from _wp_old_slugs … That too did not fix the problem.

    The funny thing is even if you type the URL with category id /?cat=1305 << It still redirects to the post.

    If I simply disable canonical redirects, it fixes the issue.

    remove_filter('template_redirect', 'redirect_canonical');

    However, I don’t want to disable the canonical redirects. I thought it was something to do with rewrite rules and the cache. I tried saving the permalinks (which resets the cache). I also manually flushed the rewrite rules. I emptied all caches on W3 Total Cache.

    I deleted the rewrite_rules table from wp_options and let it recreate itself.

    None of the above seems to fix the problem.

    Now I can simply write a conditional hook to disable the redirect_canonical for a special category, but I don’t think that is best practice. I would much rather detect the main issue and fix it once in for all.

    Any help is appreciated.

  • The topic ‘Purging old-slug redirects’ is closed to new replies.