I wish redirect my terms template to a page with the save slug (to allow the client to custom the page and use a template model for this page), this is my code
function redirect_archive_term() {
$categories = get_terms( array('taxonomy' => 'chapters') );
foreach($categories as $category) {
if( is_post_type_archive( $category->slug ) ) { // like chapter-1, chapter-2 ...
wp_redirect( home_url( '/'.$category->slug ), 301 );
exit();
}
}
}
add_action( 'template_redirect', 'redirect_archive_term' );
this is doesn't work because of the condition I think, there a way to target them ?
Thanks for the help :)