How can I add a custom validation for the url type in the advanced custom field.
I want to validate the input for the http:// or https://
Hi @mukesh.t,
You can use parse_url(...)
PHP function in your acf/validate_value
function.
add_filter('acf/validate_value/name=validate_this_image', 'my_acf_validate_value', 10, 4);
function my_acf_validate_value( $valid, $value, $field, $input ){
if( !$valid ) {
return $valid;
}
...
parse_url($value);
if($url['scheme'] == 'https'){
// is https;
}
...
}