Skip to content

Instantly share code, notes, and snippets.

@danieliser
Created June 23, 2020 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danieliser/c7af8757cd0276c9a2ef1fbdb40d0bfd to your computer and use it in GitHub Desktop.
Save danieliser/c7af8757cd0276c9a2ef1fbdb40d0bfd to your computer and use it in GitHub Desktop.
Force Popup Maker asset caching on.
<?php
add_action( 'wp_enqueue_scripts', 'custom_force_pm_asset_caching', 11 );
function custom_force_pm_asset_caching() {
wp_deregister_script( 'popup-maker-site' );
$cached = get_option( 'pum-has-cached-js' );
if ( ! $cached ) {
PUM_AssetCache::cache_js();
$cached = get_option( 'pum-has-cached-js' );
}
wp_register_script( 'popup-maker-site', PUM_Site_Assets::$cache_url . '/' . PUM_AssetCache::generate_cache_filename( 'pum-site-scripts' ) . '.js?generated=' . $cached, array( 'jquery', 'jquery-ui-core', 'jquery-ui-position' ), Popup_Maker::$VER, true );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment