Adding a filter with custom function to the menu / navigation

I’m not sure how you’re settings up your menus but this is probably the most reliable method. function auto_custom_type_class( $classes, $item ) { $type = get_post_type( $item->object_id ); if( $type == “marke” && has_term( “laden-1”, “laden”, $item->object_id ) ) { $classes []= “laden-1”; } return $classes; } add_filter(‘nav_menu_css_class’, ‘auto_custom_type_class’, 10, 2 ); The problem with … Read more