I want to clear the cache of a plugin on refreshing the preview of the WordPress customizer because I can only see the changes I make if the cache of that plugin is refreshed.

This because the theme mod values are stored in css files that need to have a refresh of the cache before you can see the changes. Since these css files are connected to theme mod values, I need to refresh the cache of the plugin on refreshing the customizer preview.

I have come this far with PHP:

function px_clear_bb_cache() {
FLBuilderModel::delete_asset_cache_for_all_posts();
}
do_action( 'customize_save', 'px_clear_bb_cache' );

The cache is now refreshed after saving and closing :( the customizer.

I think I need to hook into the customizer with JS + Ajax but can’t figure out how to do this.

Would be great if someone could help me out here.

Basically the PHP command “FLBuilderModel::delete_asset_cache_for_all_posts();” needs to fire every time when refreshing the preview of the customizer.

Read more here: How to add a do_action on refreshing of WP customizer?


Solution:

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: