How to change custom categories term links?

admin2025-06-06  2

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: /

I want to change it to: /

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?

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749141915a316721.html

最新回复(0)