donfloyd
Forum Replies Created
-
Forum: Plugins
In reply to: [LiteSpeed Cache] LiteSpeed deleting Divi 5 taxonomies dynamic css folder bug@jchambo It still exists – you can find it in options – builder – advanced . I think it’s good to try to turn off the lite speed inline / combine feature as it’s possible to have issues with the divi dynamic css ( and does not provide any benefits when using HTTP/2). See if you have the divi option turned on and if not try it.
- This reply was modified 2 weeks, 6 days ago by donfloyd.
Forum: Plugins
In reply to: [LiteSpeed Cache] LiteSpeed deleting Divi 5 taxonomies dynamic css folder bugThat’s a weird issue indeed. What code are you missing in the dynamic.css – you might need to analyze the difference between the working and the broken css to see what is missing if it’s not the whole css. Maybe the filtering plugin still loads something or interfering with LiteSpeed or Divi even if it is not used on the current page. If you can’t disable it you should copy the site and test it on test installation to be sure if it’s not the problem. Do you have the “input styles inline” option in Divi turned on? Maybe you can try turning it on or off depending of the current settings.
Forum: Plugins
In reply to: [LiteSpeed Cache] LiteSpeed deleting Divi 5 taxonomies dynamic css folder bug@jchambo I just tested and on the latest version Divi does not wipe the taxonomy folder in et-cache as before when you update a product / category. You can check if this is so on your installation but I think currently this particular issues should be resolved – you might have a different one. Do you get similar broken css on category pages like me – when you check the source do you get broken dynamic css links? If not it might be something else as the files should not be deleted on post changes as before. Verify within your et-cache folder if any files or dirs disappear when you make changes. I think LiteSpeed should flush on Divi manual cache flush – but you might check if this is true.
Forum: Plugins
In reply to: [LiteSpeed Cache] LiteSpeed deleting Divi 5 taxonomies dynamic css folder bugI think this change in beta 8.1 should’ve fixed it – “Overhauled the Divi CSS file system to mark files as stale rather than deleting them, allowing pages cached by performance plugins to reference old CSS files when getting out of sync with Divi.”
Forum: Plugins
In reply to: [LiteSpeed Cache] LiteSpeed deleting Divi 5 taxonomies dynamic css folder bugFor a long time I used a mu-plugin with a code to prevent the Divi cache clearing on any product / page or other kind of change that worked kinda ok. The other solution was as the one suggested by LiteSpeed to flush it each on every page / post change which kinda defeats the idea behind the cache in the first place. Anyway – Divi introduced a change that I think fixed that – I don’t remember which version it was but it was still in the beta version. I did tests after that and the bug looked fixed. I don’t know if any of the recent versions introduced it again – I will make some tests to verify it.
Here is the code that I used before the fix but I think they managed to resolve it…or maybe they
<?php
/**
* Plugin Name: Divi 5 Strict Cache Protector (Clean & Specific)
* Description: Prevents cache clearing on Products, Posts, Widgets, and Plugins by targeting specific callbacks.
* Version: 5.2
* Author: StackOverflow
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_action( 'wp_loaded', function() {
// =========================================================================
// TARGET 1: THE LOOPHOOKS (Products & Posts Fix)
// =========================================================================
$loop_hooks_class = 'ET\Builder\Packages\Module\Options\Loop\LoopHooks';
if ( class_exists( $loop_hooks_class ) ) {
// Unhook Post Status Transitions
remove_action( 'transition_post_status', [ $loop_hooks_class, 'invalidate_cache_on_post_change' ], 10 );
remove_action( 'wp_insert_post', [ $loop_hooks_class, 'invalidate_cache_on_post_insert' ], 10 );
// Unhook Deletions/Trash
remove_action( 'delete_post', [ $loop_hooks_class, 'invalidate_cache_on_post_change' ], 10 );
remove_action( 'wp_trash_post', [ $loop_hooks_class, 'invalidate_cache_on_post_change' ], 10 );
remove_action( 'trashed_post', [ $loop_hooks_class, 'invalidate_cache_on_post_change' ], 10 );
remove_action( 'wp_untrash_post', [ $loop_hooks_class, 'invalidate_cache_on_post_change' ], 10 );
// Unhook Terms and Users
remove_action( 'created_term', [ $loop_hooks_class, 'invalidate_cache_on_content_change' ], 10 );
remove_action( 'delete_term', [ $loop_hooks_class, 'invalidate_cache_on_content_change' ], 10 );
remove_action( 'user_register', [ $loop_hooks_class, 'invalidate_cache_on_content_change' ], 10 );
remove_action( 'delete_user', [ $loop_hooks_class, 'invalidate_cache_on_content_change' ], 10 );
}
// =========================================================================
// TARGET 2: STANDARD PAGE RESOURCES (Widgets & Customizer)
// =========================================================================
$resource_class = 'ET_Core_PageResource';
if ( class_exists( $resource_class ) ) {
// Remove Standard Post Save (Backup safety)
if ( has_action( 'save_post', [ $resource_class, 'save_post_cb' ] ) ) {
remove_action( 'save_post', [ $resource_class, 'save_post_cb' ], 10 );
}
// Remove Customizer Save Clear
if ( has_action( 'customize_save_after', [ $resource_class, 'customize_save_after_cb' ] ) ) {
remove_action( 'customize_save_after', [ $resource_class, 'customize_save_after_cb' ] );
}
// Remove Widget Update Clear
if ( has_filter( 'widget_update_callback', [ $resource_class, 'widget_update_callback_cb' ] ) ) {
remove_filter( 'widget_update_callback', [ $resource_class, 'widget_update_callback_cb' ] );
}
// Remove Widget Delete Clear
if ( has_filter( 'delete_widget', [ $resource_class, 'widget_update_callback_cb' ] ) ) {
remove_filter( 'delete_widget', [ $resource_class, 'widget_update_callback_cb' ] );
}
}
// =========================================================================
// TARGET 3: PLUGINS & THEMES (Specific Targets)
// =========================================================================
// Divi historically uses this specific global function to clear cache
// on plugin activation/updates.
$func = 'et_core_page_resource_auto_clear';
remove_action( 'activated_plugin', $func );
remove_action( 'deactivated_plugin', $func );
remove_action( 'switch_theme', $func );
remove_action( 'upgrader_process_complete', $func );
}, 100 );Forum: Plugins
In reply to: [LiteSpeed Cache] LiteSpeed deleting Divi 5 taxonomies dynamic css folder bugWhile waiting Divi to investigate I had to use this code that AI generated for me (probably not very professional but seems to do the job of preventing the Divi static css cache being wiped on virtually any change anywhere).
<?php
/**
* Plugin Name: Divi Taxonomy Cache Simple Protector
* Description: Prevents automatic clearing of et-cache/taxonomies folder
* Version: 1.0
*/
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
/**
* Simple solution that loads early and removes ALL cache clearing hooks
*/
function divi_prevent_taxonomy_cache_clearing() {
// Remove ALL hooks from et_core_clear_wp_cache_files with different priorities
$actions = array(
'save_post',
'delete_post',
'trash_post',
'edit_term',
'delete_term',
'wp_update_comment_count',
'woocommerce_update_product',
'woocommerce_delete_product',
'updated_option'
);
foreach ($actions as $action) {
// Remove with all possible priorities
remove_all_actions($action);
// Specifically target et_core_clear_wp_cache_files
remove_action($action, 'et_core_clear_wp_cache_files', 10);
remove_action($action, 'et_core_clear_wp_cache_files', 5);
remove_action($action, 'et_core_clear_wp_cache_files', 1);
remove_action($action, 'et_core_clear_wp_cache_files', 999);
}
// Remove Dynamic Assets cache clearing if the class exists
if (class_exists('ET_Builder_Dynamic_Assets_Feature')) {
remove_action('save_post', array('ET_Builder_Dynamic_Assets_Feature', 'clear_cache'));
remove_action('delete_post', array('ET_Builder_Dynamic_Assets_Feature', 'clear_cache'));
remove_action('edit_term', array('ET_Builder_Dynamic_Assets_Feature', 'clear_cache'));
remove_action('delete_term', array('ET_Builder_Dynamic_Assets_Feature', 'clear_cache'));
}
// Remove page resource auto-clearing
remove_action('switch_theme', 'et_core_page_resource_auto_clear');
remove_action('after_switch_theme', 'et_core_page_resource_auto_clear');
remove_action('activated_plugin', 'et_core_page_resource_auto_clear');
remove_action('deactivated_plugin', 'et_core_page_resource_auto_clear');
remove_action('upgrader_process_complete', 'et_core_page_resource_auto_clear');
}
// Hook early - mu-plugins load before regular plugins
add_action('plugins_loaded', 'divi_prevent_taxonomy_cache_clearing', 1);
add_action('init', 'divi_prevent_taxonomy_cache_clearing', 1);It seems Divi4’s logic is the same – purging it every time – the only reasons it probably does not break with Litespeed is that maybe the Divi 4’s Litespeed purge works while I can confirm that editing a product or post will not trigger Litespeed purge coming from Divi (If i don’t set the manual purge action).
I guess the best solution for this will be to be implemented selective purging like the one by Litespeed (I think Divi actually cleans only the static css for the post / product too, but alongside it wipes out the whole taxonomy too which is problematic.).
Forum: Plugins
In reply to: [LiteSpeed Cache] LiteSpeed deleting Divi 5 taxonomies dynamic css folder bugOk I think I finally got it – When I edit a product or post – Divi wipes out the whole taxonomy folder (this happens on Divi 4 too). This DOES not trigger Litespeed purge. Editing a category does purge Litespeed but it’s not purging Divi’s taxonomy cache folder. So I guess their code that triggers Litespeed purge or their purge is not working (at least on the current Litespeed version) or this change is not supposed to wipe this cache anyway (as editing a post only removes the taxonomy folder – not the ones located in the upper directory). I will write to them to investigate and fix this behavior.
Forum: Plugins
In reply to: [LiteSpeed Cache] LiteSpeed deleting Divi 5 taxonomies dynamic css folder bugThe code I pasted is from the Divi core files – I’m not a developer so I don’t really know if anything is wrong with it or how to fix it. (As far as I can tell it purges the whole LiteSpeed cache on any change that do not have post id in it which is far for perfect especially for categories / products (I don’t know if it coutns them as having post id – but as far my tests show it purges all of it on product change). I guess there is some scenario when this code do not run properly. Usually when the cache clean executes it wipes the whole folder not just the taxonomy one which happens in my case.
I have post_updated yes – I will try adding edit_post too (I still don’t want that aggressive purging but I guess if Divi clears it on every post edit regardless it’s type LiteSpeed should also do that unfortunately) . I’ve generated functions.php with AI that enabled me to log when the Divi and Litespeed cache is cleared and it records what triggers it. So far I can confirm from it that editing a post purges both caches without an issue. Also saving or purging from Divi’s panel clears LiteSpeed successfully.
This makes me think that some 3rd party plugin removes only the Divi cache via some cron or scheduled actions without this triggering LiteSpeed flush via Divi’s code.
After the BeRocket Ajax Filter one (I’ve modified some settings so I will see if that helps) I am also suspecting Woocommerce Product Feed Pro as it runs scheduled task that craws every product and probably modifies meta data that might trigger cache clean. I have disabled it now to check. I will report what my script logs say about the clearance of the both cache when more time passes.
I have currently disabled combine as I had another really strange error – the combined file was missing a name and generated 404 error – probably an issue with the generation due to the missing divi style. See the attached screenshot: https://freeimage.host/i/fC8VVhQ
I have enabled Litespeed’s debug log to see if it catches something when I get another bugged page.
- This reply was modified 6 months ago by donfloyd.
Forum: Plugins
In reply to: [LiteSpeed Cache] LiteSpeed deleting Divi 5 taxonomies dynamic css folder bugThe code they are referring to in the Divi/core/components/int.php file: (image was not pasted)
// LiteSpeed Cache v3.0+.
if ( '' !== $post_id && has_action( 'litespeed_purge_post' ) ) {
do_action( 'litespeed_purge_post', $post_id );
} elseif ( '' === $post_id && has_action( 'litespeed_purge_all' ) ) {
do_action( 'litespeed_purge_all' );
}Forum: Plugins
In reply to: [LiteSpeed Cache] LiteSpeed deleting Divi 5 taxonomies dynamic css folder bugResponse from Divi Support:
I took a quick look at your site, and I was able to see a similar issue on the first view of the website.
Here’s a short video:However, at the same time, using ?nocache in the URL, the same page shows fine.
Indeed, this is just caching for Litespeed, which still has old Divi files where Divi’s CSS files got updated, and didn’t clear the LiteSpeed plugin cache serving the old CSS files, which gave 404.
It’s hard to tell at the moment what exactly triggered the Divi’s CSS file to change.
When Divi’s Cache is cleared, it will also clear the cache of Litespeed based on this script used on the Divi5
Divi/core/components/int.php file:

And the Litespeed cache cleared is called from the Divi’s native “et_core_clear_wp_cache” function.
Based on the function, if the Post_ID is sent while clearing cache, it will only clear cache of that post; else, it will clear all Litespeed cache.
According to the issue that you are having which is only happening with the taxonomy pages, I’m afraid that the Support team doesn’t have any information to share.
However, I’ll share all the information I have gathered from this conversation with our dev team and will request to review the Litespeed cache clearing system along with Divi’s cache and investigate on possible causes for this kind of issue.
// As I expected pretty much the issue is that Divi does not force LiteSpeed to clean when it cleans. They provided a code that supposedly should this but I guess it does not work as expected. Can you tell what might cause it to not function?
Forum: Plugins
In reply to: [LiteSpeed Cache] LiteSpeed deleting Divi 5 taxonomies dynamic css folder bugHi again! Some updates on the issue:
I’ve been in touch with the Divi support and I’ve provided them with the information that I have and I am expecting some response soon.
What I’ve learned so far: Most likely the bug scenario is: LiteSpeed caches the page with link to the dynamic.css – Divi meanwhile has cleared the file – variant 1 Lite speed loads a cached version of the css – Everything is ok –variant 2 – the bug happens – LiteSpeed loads cached page but do not load cached css but requests the missing file. (Please tell me when this scenario can happen – why LiteSpeed might serve a cached page but no cached css file)
Reasons for divi taxonomy deletion without any edits of posts or any backend activity
I’ve included currently a script that detects when the dynamic css is cleaned – it looks it is purged on any post change – which by itself will cause issue as LiteSpeed will not clean the cache on those occasions (that’s the reason why your solution to purge all on change will work on this scenario). This is not very practical though. The dynamic css purge happens even on unrelated posts like orders.
The problem with my setup is that Divi dynamic css is cleaned even without any edits – probably cause is some 3rd party plugin triggering in through some cron / scheduled action or other automatic method. Main suspect right now is BeRocket Ajax Filters – I will report if this is confirmed.
Conclusion and questions
Even if I resolve the cache clearing that is not based on manual change the fact that Divi cleans its cache on every change is a bit of a problem when LiteSpeed does not do that by default. Moreover even if I set up the purge all action on post update Divi has an automatic purge that occurs in 6 days or something. So even than this purge can happen and LiteSpeed will not know or purge its cache.
Questions: Do you know what can cause LiteSpeed to have missing dynamic css cached file when loading a cached html containing the broken dynamic css and can this be prevented is some way. If this is not happening the bug will not occur as usually even if the cache folder is missing Litespeed serves the cached one and it’s ok. Once this fails the broken page gets cached and stays broken until purge.
Forum: Plugins
In reply to: [LiteSpeed Cache] LiteSpeed deleting Divi 5 taxonomies dynamic css folder bugI’ve written to Divi and reported the bug & I will write if they respond in a meaningful way. Haven’t had the issue since enabling the purging trigger but as the bug occurs rarely I am still not convinces it won’t happen again.
Divi purges those dynamic css very frequently without any change in the backend or update in the css itself (reason uknown) so LiteSpeed will definitely can serve a cached page linking to missing file. LiteSpeed serves most of the time a cached version of though so even if it’s not there it still loads it from the cache. The problem occurs I guess when the page is cached but the css is not served either from the memory or disk cache (or the browser cache). Is this a expected behavior from LiteSpeed – to serve cached page but to request the css from the server? As those dynamic css files are different (although identical) it has to cache them individually. Do you think the purge setting will help in those scenarios where the dynamic css is being removed without any post change? Some rare race between LiteSpeed caching and Divi is removing and than regenerating might be causing this too. Thanks again for your help.
Forum: Plugins
In reply to: [LiteSpeed Cache] LiteSpeed deleting Divi 5 taxonomies dynamic css folder bugI have added post_updated (Should I add edit_post too?). I’m running with no critical and inline css – with combine and minify enabled + the new purge. So far I haven’t encountered the bug but as it happens quite rarely I will continue testing (last time it took quite a lot of category opening to appear with the combine). I checked and it looks the constant purging of those items in the taxonomy is not unique to Divi5 and it looks that on Divi4 they are randomly refreshed even with no updates on posts / products. I suspect some race conditions occur at times when Litespeed caches the page before or at the moment of the css generation but I’m not a developer so my insight is very limited. It’s weird that refreshing the page still produces the broken layout as what it looks in the code there are checks that run to verify and re-create it. I still can’t grasp the logic behind the dynamic and the dynamic-late regeneration in the code I pasted from the DyamicAssets.php and the relationship between those two. As I was running the website on an apache server for quite some time with no issue I have to believe that Litespeed comes in to play somewhere. As I mentioned I have tried to exclude the directory from caching but that didn’;’t help (I guess this has to do more with the page caching rather than the css files themselves) . Thanks for help.
Forum: Plugins
In reply to: [LiteSpeed Cache] LiteSpeed deleting Divi 5 taxonomies dynamic css folder bugWhat makes this weirder is that all those dynamic css files are identical for all the categories (at least in my case) which is making their generation even more unnecessary. If everything fails I will have to brute force disable it in some way and add it as a static file…
*Edit – With AI I analyzed the DynamicAssets.php and among other things is said that this code is responsible for the et-divi-dynamic.css and et-divi.dynamic-late.css located in those taxonomy folders.
$files = (array) glob( "{$this->_cache_dir_path}/{$this->_folder_name}/et*-dynamic*{$this->_tb_prefix}*" );
foreach ( $files as $file ) {
if ( ! et_()->includes( $file, '-late' ) ) {
$generate_assets = false;
break;
}
}
if ( $generate_assets ) {
// Regenerates if files are missing
$this->generate_dynamic_assets();
}If you think something in it can conflict with the Litespeed or can be easily fix please share. Thanks!
This one has something to do with the taxonomy handling
// In get_folder_name()
if ( DynamicAssetsUtils::is_taxonomy() ) {
$queried = get_queried_object();
$taxonomy = sanitize_key( $queried->taxonomy );
$folder_name = "taxonomy/{$taxonomy}/" . $this->_object_id;
}Forum: Plugins
In reply to: [LiteSpeed Cache] LiteSpeed deleting Divi 5 taxonomies dynamic css folder bugThanks! I added post_updated – should I add also edit_post or this is enough?
I have to say that the removal of the dynamic css folders in the et-cache/taxonomy does not happen only when a product or category is edited. When it’s edited the whole folder is removed and after visiting a category is regenerated – but the individual category dynamic css folders inside are removed at some point, even if there is no editing – so I guess the problem can still occur even if the cache is purged when a product is edited. I don’t really know the logic behind those dynamic.css purges as they happen very frequently – I can have let’s say 20 folders inside but after some time I can get 3-4 in it. Really weird behavior – If this is not resolved I will write to Divi to see if they can do anything about it. I will report if I encounter the bug again with this fix – if you have any other suggestions please write. *I will monitor the number of folders and date of modification to see if they reduce without any action in the backend (maybe the critical css or the inline styles generator forces the clearance of the category folders for some reason or might be some other inner Divi logic to remove them even if they are not manually purged or changed).
- This reply was modified 6 months ago by donfloyd.