0

I have been trying to solve this problem for hours. I would like to have a page with a simple slug (/blog) and a category term with the same name (/category/blog) exist on my site together at the same time. But the problem I am running into is that my page (/blog) keeps redirecting to the category archive page (/category/blog).

I have tried the following:

  • adjusting my permalinks by clearly specifying my category base
  • using remove_action('template_redirect', 'redirect_canonical'); to suppress redirects
  • using add_filter( 'template_redirect', 'blog_redirect_filter', 10, 3 ); to try and target my blog category specifically

I am running out of ideas. How can I stop my site from redirecting an existing page to a category archive when they each have different slugs?

EDIT

I figured it out! Classic wait-until-you-post-publicly-before-figuring-it-out-yourself problem. It was a fun mix of Yoast, custom permalinks, and category bases all conflicting with each other.

My answer:

  • Make sure your category base is specified in Permalinks. Save them.
  • Remove any custom permalink slugs in the category terms.
  • Go to Yoast > Search Appearance > Taxonomies and scroll to the very bottom. Make sure Category URLs is set to Keep.
  • Clear any cache and/or flush_rewrite_rules.
  • Voila it's fixed.
1
  • 1
    Hey! Can you post your solution as an answer instead off editing it into the question? We can't upvote an edit, it means you don't get reputation points for solving your problem, and your question looks like it has no answer on the site :(
    – Tom J Nowell
    Sep 9, 2020 at 16:03

1 Answer 1

1

Thanks @Tom J Nowell for suggesting I post this fix as an answer!

So the answer I found was that Yoast, a custom permalink plugin, and permalinks category bases were conflicting with each other on my site. Here's what I did to fix it:

  • Make sure your category base is specified in Permalinks. Save them.
  • Remove any custom permalink slugs in the category terms.
  • Go to Yoast > Search Appearance > Taxonomies and scroll to the very bottom. Make sure Category URLs is set to Keep.
  • Clear any cache and/or flush_rewrite_rules.
  • Voila it's fixed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.