I want populate value in a front-end form
For a dropdown your example is :
function my_acf_load_field( $field ){
$field['choices'] = array('custom' => 'My Custom Choice');
return $field;
}
add_filter('acf_load_field', 'my_acf_load_field');
I’have found for a field text or textarea :
function my_acf_load_field( $field ){
$field['default_value'] = "2010-02-21 00:00:00";
return $field;
}
add_filter('acf_load_field', 'my_acf_load_field');
But I don’t found for Date type (datepicker)
Can you help me please.
Thk
for populate a filled out value at frontend you can do something like that:
<?php
/*
* Create PHP DateTime object from Date Piker Value
* this example expects the value to be saved in the format: yymmdd (JS) = Ymd (PHP)
*/
$date = DateTime::createFromFormat('Ymd', get_field('date_picker'));
echo $date->format('d-m-Y');
?>
official Datepicker Documentation
or did you wish to prefill a datepicker field?