I got the following code:
function wpa_alter_cat_links( $termlink, $term, $taxonomy ){
if( 'category' != $taxonomy ) return $termlink;
return str_replace( '/category', '', $termlink );
}
add_filter( 'term_link', 'wpa_alter_cat_links', 10, 3 );
It’s stripping down my categories e.g. domain.xyz/category/cars/ to -> domain.xyz/cars/ and shows a page instead the archive page with posts.
Now I got a subcategory called "volkswagen" I also want to display as page (domain.xyz/cars/volkswagen/. Instead it get shown as archive page (domain.xyz/category/cars/volkswagen/.
How to edit the above code to show subcategories this certain way as well?