I am building controls (a) that are generated using a value from a control (b) in another section.
However, unless the full customize page is refreshed then then there doesn’t seem to be a way to update (a) when (b) changes. Is there a solution for this use-case?
I am building controls (a) that are generated using a value from a control (b) in another section.
However, unless the full customize page is refreshed then then there doesn’t seem to be a way to update (a) when (b) changes. Is there a solution for this use-case?
It depends what "update" means.
If you want just to hide or show the control, (like how WordPress sidebar area is appearing and disappearing when the sidebar is present or not) then you can use the active_callback
parameter of the customize_control like this.
Edit: Also, active_callback
works on sections and panels too.
If you want the change the control's HTML structure, or text or anything else, then it requires advanced javascript knowledge, because you need to trigger javascript events from the previewer and catch them on the panel. This example comment should be enough for this case.