I'm stuck all day trying to refresh the customizer screen after the settings has been saved. And this is driving me nuts.
I need this solution because i've hooked a function into the customize_save_after
hook to process some data after the save. And i want a refresh on the preview with wp.customize.previewer.refresh();
after the things are saved.
I've already tried to set a trigger on the save button to run this refresh method when clicked, but it fires simultaneously with the save event, and i get a refresh, but no changes on the preview ultil i reload manually the page. I've used a timer to trigger the refresh after x secs, it works, the changes are displayed on the preview, but i want to trigger automatically when the settings are saved.
Here what i've done so far:
jQuery(document).ready(function($) {
$('.save').click(function(event) {
setTimeout(
function() {
wp.customize.previewer.refresh();
}, 4000);
});
});
Can anyone help me? Thanks!
saved
event that fires onwp.customize
and that is what I think you're looking for, but yeah, if you could expound about your specific use case then a better answer can be provided.window.wp.customize
since i've discovered. I have done a good progress, and i'm about to resolve this issue.