Home › Forums › Add-ons › Flexible Content Field › Populate (same) flexible content layouts with data from other fields of CPT? › Reply To: Populate (same) flexible content layouts with data from other fields of CPT?
When ACF initially loads the value of the flex field, if it is populated, that value will an array with nested arrays for each row in the layout. What you will do is use the existing fields to build out all the layouts and return it. This will cause ACF do display all of the content you add at this point.
I don’t know what you mean by dumping it. What you are doing is replacing what ACF has loaded and the filter with the priority I gave runs after the value is laded and before ACF shows the flex field. This filter will (should) also run on the front end on the when you do if(have_rows(....
because this is when ACF loads the values. This happens between ACF loading the value and ACF formatting the values, this is why we want to get the existing fields without formatting.
In reality, with this in place you should not need to keep the old code. However, I would keep the old code and do the if/else check in the template anyway. This will not cost you anything and it is a good practice to double check and not assume.
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.