The issue I’m having is similar named posts are redirecting to the wrong pages
so urls like
example.com/terms
are redirecting to
example.com/en/terms-of-use
How do I turn off wordpress’s redirect_canonical only for the "terms" page?
Currently what I have
add_filter( 'redirect_canonical', 'disable_redirect_canonical_for_terms', 2, 10 );
function disable_redirect_canonical_for_terms( $redirect_url, $requested_url ) {
if ( strpos( $requested_url, 'terms' ) !== false ) {
return false;
}
return $redirect_url;
}
2
Answers
You can use
is_page
. check below code.