• Resolved codejp3

    (@codejp3)


    Frank,

    I’m double-tapping and creating a topic here that I already tagged you in for the bbP Style Pack plugin (see that topic here: https://www.ads-software.com/support/topic/styling-subscribe-unsubscribe/)

    Our plugin’s main purpose is to add styling options and feature enhancements to bbPress (and BuddyPress). With that said, CSS and JS files are (re)generated almost every time a setting is changed. We’ve tried various tricks to force plugins and CDNs to re-cache/re-load those new files (such as enqueuing using the last generation timestamp as the version number) and have successfully taken care of a majority of cases, but there are still cases where we get support topics stating that “it’s not working” and after clearing cache/resetting performance plugins, they “magically work”.

    AutOptimize is one of those cases. Your plugin is a quality one for sure, but maybe it works a little too good. ??

    I was wondering if you had a function or hook we can tap into to force a reset of minified/compressed/concatenated files handled by AutOptimize? Something like the built-in “wp_cache_flush()”. Either site-wide, or specific files would be suitable for this purpose.

    I looked through API docs like this (https://github.com/wp-plugins/autoptimize) but didn’t see anything specifically addressing this capability.

    We’d like to prevent users from having to reset AutOptimize every time after they make a change with settings in our plugin, and automatically handle that for them. It’s far more convenient for them, and will save us on many “it’s not working” support topics at the same time.

    If there is no suitable option in the plugin now, I’d like to request this feature in a future release. Thanks for your time!

    John Patrick Hayden III
    – codejp3

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    morning codejp3 ;
    Autoptimize _should_ detect updated CSS/ JS: it calculates an md5-hash of the CSS/ JS found and uses that hash to store the optimized version in AO’s cache, so if the content changes the hash changes and the cached version is not found to a new version is created in the cache.

    Now when AO’s cache is cleared, it tries to also clear the page cache, so my best guess is that it is the triggered clearing of the page cache that fixes the problem and not the purging of AO’s cache itself.

    That being said, yes you can programatically purge AO’s cache by calling autoptimizeCache::clearall() ??

    hope this helps,
    frank

    Thread Starter codejp3

    (@codejp3)

    Perfect!

    I’ve added this to the next release of Style Pack. Any time we generate new files due to settings/value changes, we clear AutOptimze as well (if installed/activated).

    In case anyone else wants to add this capability to their own plugin or custom code, here’s the final code snippet that has been tested and is working as expected:

    if ( class_exists( 'autoptimizeCache' ) ) autoptimizeCache::clearall();

    Resolved ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Function/Hook to clear/reset AutOptimize?’ is closed to new replies.