Automatic Asset Cache Deletion on Domain Change

I’m running a WordPress multisite setup (subdirectory per site) and using the WordPress MU Domain Mapping plugin to map each site to an independent domain. I have admin SSL enabled to allow for secure authentication and force all editing to be done through the admin url so that ssl can be enforced on all sites.

I also have WP Super Cache installed and set to cache pages for 1 hour.

When viewing a site the url is:

http://site-slug.domain.com/page (mapped domain)

When in the dashboard or editing using Beaver Builder the url is:

http://home-site.domain.com/site-slug/page

So, when “page” is viewed the html is cached for 1 hour, however if the page is edited in Beaver Builder the ‘delete_asset_cache_domain_change’ method is called and home_url is different so the ‘delete_all_asset_cache’ method is called.

The problem is that the next person to view “page” gets a broken layout because WP Super Cache serves cached html that links a since-removed BB layout.css asset from its cache.

To fix this I’m using the following code to disable the auto-asset cache deletion, but wasn’t sure if this was the best way to handle this problem.

remove_action('init', 'FLBuilderModel::delete_asset_cache_domain_change');

That looks correct to me. We’re actually going to remove that in the next release as we now have a clear cache button in the builder’s settings. Sorry for the hassle!

Justin

Thanks for the update! A clear cache button seems like a solid way of handling this. I’ll make note to keep an eye out for this in the next release.

John

Hey John,

We actually have one already! :slight_smile: It’s under Settings > Page Builder > Cache.

Justin