Home › Forums › Add-ons › Options Page › Option values should be saved as a serialized array › Reply To: Option values should be saved as a serialized array
Been thinking about a good reason why not save some things in serialized arrays.
I think it has something to do with the way the fields themselves are save. Each field is a post, and fields can have child fields in the same way that pages can have child pages.
The one thing that I like about ACF is that the same functions are used for getting values from any field. Also, the same code is used in ACF itself to get any type of field no matter if it is a top level field or a field that is a sub field of a repeater of a sub field of a repeater that is a sub field of a flexible content field. Looking at it from the view of parents and children makes the code more usable in all conditions rather than having alternate code that needs to be run for different field types.
There is also the fact that it makes it easy to use standard WP functions for getting the data. ACF function, for the most part, are just wrapper functions for get_post_meta() and get_option(), so it makes sense to store data with them in mind and not need to do a lot of manipulation of that data after it is retrieved.
I’m not sure I hit on a reason that makes sense to everyone, and I’m sure there are a lot more possible reason.
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!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.