Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    There’s no setting, you’d need to develop your own custom functionality. Use an action hook such as “template_redirect” to call wp_redirect(). You can get the current post object with get_queried_object() and its canonical URL permalink with wp_get_canonical_url().

    The tricky part is you must not redirect if the request is already the canonical URL, otherwise you’ll enter an infinite redirect loop. Verifying this involves string comparisons between requested and canonical URLs. If not done thoughtfully, you could get a false negative and end up with the infinite loop anyway.

Viewing 1 replies (of 1 total)
  • The topic ‘Redirect Multiple category URL to permalinks’ is closed to new replies.