Support

Account

Home Forums Add-ons Flexible Content Field Flexible Content – get_fields – is the order guaranteed? Reply To: Flexible Content – get_fields – is the order guaranteed?

  • get_field() will, as far as I know, return the fields in the order that the meta values were created.

    The “unique” part is difficult when using repeaters and flexible content, which is the reason that ACF uses the method that it does for storing the data in the database. Flexible content and repeaters can be considered the same when it comes to how they are stored. The only difference is that the meta value for a repeater is then number of rows and the flex field is an array of layout. But, perhaps the way that ACF works will help you. The “meta_key” values for repeater and flex field layouts are

    
    "{$repeater}_{$index}_{$sub_field}"
    // $repeater  = name of repeater or flex field
    // $index     = row, starting at 0
    // $sub_field = name of sub_field
    

    nested repeaters look something like this

    
    "{$repeater}_{$index}_{$nested_repeater}_{$index}_{$sub_field}"
    

    At any rate, this is how ACF creates unique meta keys

    Not sure if any of this helps you at all