Home › Forums › Backend Issues (wp-admin) › Adding custom validation in admin fields › Reply To: Adding custom validation in admin fields
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;
}
...
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.