After a lot of troubleshooting and debugging I’ve found that fields exported from ACF v5 Pro are not compatible with those exported from ACF v4 (lite). When using ACF Pro to export fields to be used in acf_form as part of a free plugin that includes ACF I got the following error:
Undefined index: options in advanced-custom-fields\core\api.php on line 987. I found partial mention of this issue in this Github issue from Aug 2015.
Strangely there was mention in this forum topic that
acf_add_local_field_group are basically the same function and should return the same content. However looking at the exported code there are lots of differences in the fields returned. This is not documented anywhere in the ACF Pro documentation and it should be clarified that exported fields are not backwards compatible between v4 and v5.
Yes, there are differences between ACF4 and 5. I don’t think that the developer would consider this a bug.
ACF4 had the following array elements for a field group
'options' => array ( 'position' => 'normal', 'layout' => 'no_box', 'hide_on_screen' => array ( ), ), 'menu_order' => 0,
These are replaced in ACF5 with
'menu_order' => 0, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => 1, 'description' => '',
This reflects some of the added features of ACF5.
There are other things that make ACF4 and ACF5 incomparable, as you mentioned, the function name for added a field group has changes. Many hooks have changed as well. The fact that modifications to the database need to be made should be an indicator that what works in one will not work in the other. https://www.advancedcustomfields.com/resources/upgrading-v4-v5/, https://www.advancedcustomfields.com/resources/whats-new-version-5/
ACF5 can do things that ACF4 cannot do. There are field types that are available in ACF5 that were not available in ACF4. If you are creating a plugin meant to work specifically with ACF4 then I would build it while using ACF4 just to make sure I didn’t include something that would not function.
Maybe I’m odd, but I take it for granted that a plugin will most likely not be backwards compatible.
If you still think that this requires attention then you should submit a support ticket. https://support.advancedcustomfields.com/new-ticket/
You must be logged in to reply to this topic.
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!
© 2022 Advanced Custom Fields.