Mark menu item as current-menu-item for category

I use this functions. First of all, you have to add some custom class to your menu item (allow class input in Screen options, it’s not visible by default).

function mark_menu_item_as_active($classes, $item) {

    if( in_array('my-custom-class',$classes) && ( is_category('my-category') /* OR ...*/  ) )   {
        $classes[] = 'current-menu-item';
    }

    return $classes;
}
add_filter('nav_menu_css_class', 'mark_menu_item_as_active', 10, 2);

This function iterates through all menu items, and you will find your target item with that custom menu class. Then you will check whatever conditions you have (is_category, …), and add another class to its classes (current-menu-item, …).