Home › Forums › ACF PRO › Creating a read only field › Reply To: Creating a read only field
Hi,
I’ve just given it a go with a combination of another function to autopopulate it with today’s date but the field itself is still clickable. Is this supposed to happen or is the function you have given not worked?
function my_acf_update_value( $value, $post_id, $field )
{
$time = date('d/m/Y');
$value = $time ;
return $value;
}
add_filter('acf/update_value/name=updated', 'my_acf_update_value', 10, 3);
add_filter('acf/load_field/name=updated', 'sampleFunction');
function sampleFunction( $field ){ $field['disabled']='1'; return $field; }
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.