@StephenHarris So, instead of me taking care of all that, I found out a way to let wordpress deal with it i.e., Instead of simply returning
$requested_url
, I am now doing this:
return str_replace( 'intl', $cat, $redirect_url );
. This allows any
existing category in the URL while also making sure there that all the other default WordPress rules apply (like dealing with unnecessary characters in URL, etc.). Posted my answer here:
wordpress.stackexchange.com/a/120942/10691