Support

Account

Home Forums General Issues Registering Fields Upon Theme Installation Reply To: Registering Fields Upon Theme Installation

  • The best way to do this is to create a folder named acf-json in your theme folder. Then save all of the field groups. This will automatically save each field group in the theme and when this theme is installed these field groups will automatically be used in the theme.

    The format of the field groups when exporting from ACF is different than the format of the field groups in the acf-json folder and what is expected there. In the json folder each file contains an array representing each field group, a representation would be something like

    
    $group = array(
      // field group settings
    )
    

    When exporting what you get is a multidimensional array containing 1 or more field groups that could be represented by something like

    
    $groups = array(
      array(
        // field group 1 settings
      ),
      array(
        // field group 2 settings
      ),
    )
    

    The only downside to using the acf-json folder is that the field groups cannot be modified after theme install, however, I would think that would be the goal for a theme that someone else would install.