Support » Themes and Templates » How to manually save and bind the options in Theme Customizer

  • Hi,

    I’m trying to do one thing in Theme Customizer which is to save and load the options manually using the button in one custom control.

    Supposed I have a custom control that contains a textarea and a button. The purpose of this control would be like allowing user to enter the input into the textarea then click the button and that input will be saved into the database. Right after that, the entire page is forced to reload (or is there any way to implement AJAX here?) for binding that saved input into any other controls for further selection.

    Do you have any advice on this?


Viewing 4 replies - 1 through 4 (of 4 total)
  • esmi


    Forum Moderator

    Thanks for your help esmi. I have read them already but still couldn’t find how to do that manually.

    In fact there is no problem with the “general” custom controls. I can register them and use the default “Save & Publish” button as usual.

    The thing is that I would like to populate the data collected from the custom textarea into other custom controls right after saving. I have written the code using “get_option()” in those custom controls to retrieve the textarea’s saved data. But that doesn’t seem to work since “Save & Publish” button doesn’t reload the option panels. It did save the data but didn’t rebind the controls.

    So I’m trying to find the way to implement saving and binding them manually using the button of the custom control.

    Would it be possible to implement this or is there any advice?



    Forum Moderator

    Have you reviewed this article?

    I am also intrested about this.

    While trying to create customizer lists control ended up with same problem.

    I am adding, saving and deleting lists with click on buttons that invoke update(). And that is fine for preview part and saving data, but there are other controls that depend of the lists input, and they are not refreshed when Save & Preview.

    So now I have two solution, first is to call reload on whole page with javascript or php, and second to create JS code that will handle all data refresh on all controls in theme customizer that depend from lists values.

    Anyone have better solution?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to manually save and bind the options in Theme Customizer’ is closed to new replies.