I want to clear the cache of a plugin on reloading the preview of the WordPress customizer because I can only see the changes I make if the cache is refreshed. I can do this manually, but my goal is to do it also when the WP customizer refreshes.

I have come this far:

function px_clear_bb_cache() {
do_action( 'customize_save', 'px_clear_bb_cache' );

I’m running into the following problems:

  1. After saving the customizer, I can only see the changes after closing the customizer. It would be great if the customizer reloads / refreshes on save.
  2. But even better would be if the above php function would fire every time the customizer reloads / refreshed when a value is changed.

Read more here: How to fire a do_action on reloading the WP customizer?


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: