Support

Account

Home Forums General Issues Set default for Time field?

Solved

Set default for Time field?

  • I have tried to find a solution to this but can’t figure it out. Is there a way to set the default value for a time field?

    Seems simple but I cannot find a way to set this.

  • 
    add_filter('acf/prepare_field/name=time_field', 'my_default_time_set');
    function my_default_time_set($field) {
      if (empty($field['value'])) {
        $field['value'] = '00:00:00'; // 12:00am
      }
      return $field;
    }
    
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Set default for Time field?’ is closed to new replies.