Home › Forums › Backend Issues (wp-admin) › Date Picker – Prefilled To Today › Reply To: Date Picker – Prefilled To Today
Its Oct, 2020 now…
I wish to have the date set to today ONLY upon creation.
BUT, ACF pro latest (5.9.1) seems to ignore it.
Even when I modify the date – it will DISPLAY today date
And will retain the original in the database (ie. not updating…)
Here is my code:
add_filter('acf/load_field/name=YOUR_FILED_NAME', 'my_acf_default_date');
function my_acf_default_date($field) {
if (isset($field['default_value']) && $field['default_value'] != "")
return $field; // do not change...
$field['default_value'] = date('Ymd');
return $field;
}
Any idea how to manage this behavior is highly appreciated. Thanks!
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.