add_filter( 'nav_menu_css_class', 'change_menu_item_css_classes', 10, 3 );
function change_menu_item_css_classes( $classes, $item, $args ) {
if ( $args->menu === 'Main' ) {
$classes = [ 'nav-item' ];
} else {
$classes = [];
}
return $classes;
}