Support

Account

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!