Open JiveDig opened 4 years ago
Hi @JiveDig
Great question. I'm not exactly sure how this would be possible, but I'll start searching for a solution đź‘Ť
I started testing passing the existing value to the template, only if there is an existing value. Didn’t get it to work, but that would still require the “old” field to be registered so it works with get_field(). Another layer or difficulty is that the old field won’t be available anymore since it’s now just using innerBlocks.
Still not able to to do this. Tried a few ways and got stuck. I'm thinking the only solution may be to leave the old field registered but hide it via conditional logic that is always false
, then load_field
filter to check for that value or something like that. It'd get tricky though as we'd need to clear the old field value on save of the new field.
Yep, this is a tricky one indeed. I've still got this on my to-do for RC2, but haven't looked into it just yet.
Just to update: I released an update to my plugin which now uses InnerBlocks.
Here's the logic:
acf/prepare_field
filter which then hides the old field once content is cleared, or for new instances.I'd love a way that didn't require copy/paste or leaving the old field registered, but this solution is working as of now.
Hi @JiveDig. Great work!
I agree. An automated solution for setting the InnerBlocks content would be ideal. I still have this on my to-do list for the 5.9 version and hope to find a solution in the future.
For now, I'm glad you have a working update đź‘Ť.
P.S. Can you remind me of the plugin you are working on? I've lost track, sorry.
Thanks Elliot. Still super excited for inner blocks. I have a few things I need to convert/update, but this one took priority. It's a GitHub-only plugin as of now https://github.com/maithemewp/mai-notices
I have an ACF block heavily used on a few large sites. I'd like to update the block to only use innerBlocks in place of an existing WYSIWG field. Trying to figure out a way to
get_field( 'my_content' )
and pass that to the innerBlocks (or some version of that) the next time the post/page is edited.