The new 5.6.0 version introduces the Group field type.
In what this field is different from the old Flexible Content field type?
I have the same question, and can’t find an answer anywhere here or on Google (searching leads to this post).
I know that Group is the newer field type. Is there a performance gain in using Group?
Say I help Jerry Seinfeld with a website, and I’ve created a field group entitled “Comedians in Cars – Shows”. In addition to the fields Guest, Place, and Date, I have a field Car and want sub-fields of Make, Model, Year, Photo, and Description.
- Guest
- Place
- Date
- Car
- Make
- Model
- Year
- Photo
- Description
Is there a benefit to using Group rather than Flexible Content for the Car field?
I’m obviously missing something. Thanks!
A Group field is almost identical to a repeater field. A group field is a repeater that always has exactly one row.
if (have_rows('group_field')) {
will always return true.
The other difference is that get_field('repeater')
will return
array(
0 => array(
'sub_field_1_name' => 'sub_field_1_value'
'sub_field_2_name' => 'sub_field_2_value'
),
1 => array(
'sub_field_1_name' => 'sub_field_1_value'
'sub_field_2_name' => 'sub_field_2_value'
)
)
and get_field('group_field')
will return
array(
'sub_field_1_name' => 'sub_field_1_value'
'sub_field_2_name' => 'sub_field_2_value'
)
Then again, for anyone that’s interested…
A flexible content field is simply a repeater that can have different fields on each row.
And a clone field is a repeater that works in almost the same way as a group field, but with a few more headaches 🙂