Hey folks- I’m working on an ACF for a client where they want to be able to specify a “label” for a post, and the label can be any of the assigned tags or terms from a custom taxonomy. Right now, I’m using a select ACF field and customizing the options using the tags & terms required. This is fine, and it loads correctly.
However, if I assign new terms in the editor, I’d like these options to update to reflect the changes. Right now, this requires a two-step process: 1) assign the items & Save/Update the post; 2) Refresh the editor page. If I want to USE the newly-assigned term, then I need to select that term and then save the post again.
Does anyone know a way to listen for changes to the terms so I can update my options? I understand that none of them are actually assigned until the post is saved, so even post-save JS event would be useful, that way I can hit the REST API for the current terms.
I’d poll the DOM, but the Gutenberg sidebar is less than helpful there, as none of the individual components have anything seemingly safe to hook onto (ID, data attribute, etc) to know which is which.
Or…. Is there an ACF way to hook into the JS post save function that would re-render the ACF metabox?
Viewing 1 post (of 1 total)
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