Add limit validation or any validation to specific field – ACF taxonomy field validation

Following is useful for taxonomy field type. There is no option in ACF to set min max for taxonomy multi-select.

add_filter('acf/validate_value/name=select_product_category', 'my_acf_validate_value', 10, 4);

function my_acf_validate_value( $valid, $value, $field, $input ){
	
	if( !$valid ) {
		return $valid;	
	}
	if(sizeof($value) > 3) {
		$valid = 'You can only select 3 terms';
	} else {
		$valid = true;
	}
	return $valid;
	
	
}

Limit Taxonomy Multi Select Dropdown