0

I have created "Tour Vacation"(tour-vacation) custom taxonomy and added below terms

  • Africa (africa)
  • Canada (canada)
  • Europe (europe)
  • US (us)

I want change this terms links.

Current link is: https://tourjourneys.staging.com/africa/

I want to change it to: https://tourjourneys.staging.com/vacation-pacakge/africa-tour/

So i have done below code.

add_filter( 'term_link', 'change_term_link', 10, 3 );
function change_term_link( $url, $term, $taxonomy ) {
  if ( 'tour-vacation' === $taxonomy ) {
    $url = home_url() . '/vacation-pacakge/' . $term->slug.'-tour';
  }
  return $url;
}

The link is changing but it's showing "404 page not found error"

Am i missing anything?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.