• Resolved Gal Baras

    (@galbaras)


    Whenever I update Divi, I get script errors due to its use of a static file cache for JS and CSS files, despite caching options being disabled in the theme settings.

    From what I understand, Autoptimize recreates its files when the theme is updated and triggers a page cache clearing (I use WP Fastest Cache), so I’m looking for a way to clear the Divi static file cache when Autoptimize clears it own.

    The following code does this:

    ET_Core_PageResource::remove_static_resources( 'all', 'all' );

    Is there an action hook I can use for this?

    Frank, will you consider integrating with Divi for other users’ benefit? It’s a pretty popular theme.

    The page I need help with: [log in to see the link]

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

    (@optimizingmatters)

    AO itself does not trigger an update on a theme or plugin update, but WP Fastest Cache does and AO “listens” for that using WPFC’s wpfc_delete_cache action, so I would use that one galbaras ? ??

    hope this helps,
    frank

    Thread Starter Gal Baras

    (@galbaras)

    Excellent. Thank you, Frank.

    For anyone interested in code to copy, here’s what I’ve decided to use (still untested):

    add_action( 'wpfc_delete_cache', 'custom_clear_divi_cache' );
    function custom_clear_divi_cache() {
    	if ( class_exists( 'ET_Core_PageResource' ) ) {
    		ET_Core_PageResource::remove_static_resources( 'all', 'all' );
    	}
    }
    Thread Starter Gal Baras

    (@galbaras)

    The above code seems to create an infinite loop ??

    Is it possible the Autoptimize (and maybe WP Fastest Cache) keeps getting triggered by the clearing?

    • This reply was modified 10 months, 4 weeks ago by Gal Baras.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    The problem is likely that clearing the Divi cache causes wpfc to also clear the cache, you could try adding checking/ setting a short-lived transient to inside the custom_clear_divi_cache function; if the transient does not exist set it and call the Divi function, if the transient exists do not call the Divi function?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Automatic clearing of Divi static file cache’ is closed to new replies.