Support

Account

Home Forums Backend Issues (wp-admin) Automatically setting default settings on new multisite install Reply To: Automatically setting default settings on new multisite install

  • At the top of the page when editing the field group under screen options you can show the field keys.

    A group field is actually a special type of repeater field that always has exactly 1 row. So the difference in the array structure is that you do not need sub arrays for each row.

    As far as default values vs blank field entries there is a way to detect this. If a field has been edited but contains no value the the return will usually (but not always) be different than if the field was never set. In most cases the value will be false or null if it was never set and will be an empty string if it was set.

    
    if ($value !== '') {
      // value does not exactly equal an empty string
      // it was never set
      // use a default value
      $value = 'my default value';
    }
    

    of course this will not always work and you’d have to test different types of fields to see what they are when never set vs having been saved without a value.