Support

Account

Home Forums Backend Issues (wp-admin) Auto-restore default field values? Reply To: Auto-restore default field values?

  • There is no setting to restore the default value. I think you have 2 options.

    If you want the editor to see that it’s being restored to the default value, that would take writing some javascript to include with your field group. Probably the more difficult of the 2 options.

    The other option is to add a filter to check the value before the database is updated, probably the easier option.

    
    add_filter('acf/update_value/name=my_field_name', 'my_acf_update_value', 10, 3);
    function my_acf_update_value($value, $post_id, $field) {
      if (empty($value)) {
        $value = $field['default_value'];
      }
      return $value;
    }
    

    for more information see the update_value doc page: http://www.advancedcustomfields.com/resources/filters/acfupdate_value/