Support

Account

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; }