So, here’s something that I ran into and I’m not sure how to approach.
We’re creating an admin feature for Custom Post Type, let’s call it “A”, that should recalculate some data when we edit values on the edit form of said CPT. In order to perform that recalculation, we need information from CPT “B” that is not available on that edit screen.
The recalculation should be possible to perform, even without actually saving the “A” edit form. We need to send current data to the backend, perform calculations, and return results for review before the user decides to Update the CTP for real.
We know that we can run JS that will serialize edit post data, eg:
That gives me the form data in the format of:
That’s great, but parsing that would be a big pain in the …
So, WP and ACF must be parsing this somehow already, in order to save it to the object. I wonder if there’s a good way to convert this serialized form to format that is returned by get_field or get_fields