Support

Account

Home Forums General Issues Creating theme fields – generating a key? Reply To: Creating theme fields – generating a key?

  • Hi @squarestarmedia

    Great questions

    1. The field_key can be ANYTHING you want but MUST start with field_
    2. To generate a key in the same way that ACF does, use this:

    
    $key = 'field_' . uniqid();
    

    3. You can create function which returns an array (1 single field), and then call this function when you want the field. This is a way to include 1 field in multiple field groups. It will use the same field key, and that’s fine because the field_key is only used to load the field object and use it’s settings to modify the interface and value.

    Thanks
    E