admin管理员组

文章数量:1130349

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?

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?

本文标签: How to change custom categories term links