I have an issues after upgrading my existing 4.3.8 to 5.0.1. The problem is the flexible content field. The accordion of some fields does not work.
I have tried to find a solution for that. And it seems that every field within a layout needs a starting ‘field_’ in the ‘key’.
This does not work:
$layout_pageteaser = array (
'key' => 'key_module_pageportlets',
'label' => 'Page Teaser',
'name' => 'module_pageportlets',
'display' => 'row',
'min' => '',
'max' => '',
'sub_fields' => array (
array (
'key' => 'module_pageportlets_headline',
'label' => 'Headline',
'name' => 'headline',
'instructions' => 'This is the main headline of your content.',
'type' => 'text',
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'formatting' => 'none',
'maxlength' => '',
),
array (
'key' => 'module_pageportlets_pages',
'label' => 'Pages',
'name' => 'pageportlets_pages',
'type' => 'relationship',
'instructions' => 'Select the pages that you want to show as teaser.',
'column_width' => '',
'return_format' => 'object',
'post_type' => array (
0 => 'page',
),
'taxonomy' => array (
0 => 'all',
),
'filters' => array (
0 => 'search',
),
'result_elements' => array (
0 => 'post_title',
),
'max' => '',
),
),
);
This works:
$layout_pageteaser = array (
'key' => 'key_module_pageportlets',
'label' => 'Page Teaser',
'name' => 'module_pageportlets',
'display' => 'row',
'min' => '',
'max' => '',
'sub_fields' => array (
array (
'key' => 'field_module_pageportlets_headline',
'label' => 'Headline',
'name' => 'headline',
'instructions' => 'This is the main headline of your content.',
'type' => 'text',
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'formatting' => 'none',
'maxlength' => '',
),
array (
'key' => 'field_module_pageportlets_pages',
'label' => 'Pages',
'name' => 'pageportlets_pages',
'type' => 'relationship',
'instructions' => 'Select the pages that you want to show as teaser.',
'column_width' => '',
'return_format' => 'object',
'post_type' => array (
0 => 'page',
),
'taxonomy' => array (
0 => 'all',
),
'filters' => array (
0 => 'search',
),
'result_elements' => array (
0 => 'post_title',
),
'max' => '',
),
),
);
After adding “field_” the accordion works.
But this is a big problem for existing content, because the key changed and already saved values will not be loaded correctly into the field.
To solve that, I would need to change every field name in post_meta manually and add the “field_” prefix. This would be a hard job for all installations.
Can you add a downgrade fix to an upcoming version? Do you see a chance/solution for that?
Have a good day,
Stephan
Hi,
I’ve just add the “field_” to the flexible content items. All Layouts are working correctly.
Surprising for me is that also the existing values will be loaded correctly.
That’s good.
Does that make sense or do you see an for me unknown side effect?
Stephan
Hi guys
Thanks for the bug report and field group info.
I’ve just included a fix for this issue in the latest version of ACF PRO 5.0.3
Cheers
E
The topic ‘Flexible Content issue after upgrading’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.