Resolving A Conflict Between Cache-Enabler and Beaver Builder

WPCloudDeploy uses the Cache-Enabler plugin as part of its caching stack. But recent updates to it seems to have broken the Beaver Builder page builder (and likely some other plugins as well).

There are two symptoms of this conflict:

  1. Saving a page from inside Beaver Builder never completes. The page actually saves but control is never returned to the admin until the entire browser page is refreshed (using CTRL-R for example)
  2. The debug.log file shows an error similar to the following:
[04-Sep-2020 21:13:02 UTC] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function Cache_Enabler_Disk::delete_asset(), 1 passed in /var/www/yourdomain.com/html/wp-content/plugins/bb-plugin/extensions/fl-builder-cache-helper/plugins/cacheenabler.php on line 13 and exactly 2 expected in /var/www/yourdomain.com/html/wp-content/plugins/cache-enabler/inc/cache_enabler_disk.class.php:125
Stack trace:
0 /var/www/yourdomain.com/html/wp-content/plugins/bb-plugin/extensions/fl-builder-cache-helper/plugins/cacheenabler.php(13): Cache_Enabler_Disk::delete_asset()
1 /var/www/yourdomain.com/html/wp-includes/class-wp-hook.php(289): FLCacheClear\Cacheenabler::run()
2 /var/www/yourdomain.com/html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters()
3 /var/www/yourdomain.com/html/wp-includes/plugin.php(478): WP_Hook->do_action()
4 /var/www/yourdomain.com/html/wp-content/plugins/bb-plugin/classes/class-fl-builder-model.php(4784): do_action()
5 /var/www/yourdomain.com/html/wp in /var/www/yourdomain.com/html/wp-content/plugins/cache-enabler/inc/cache_enabler_disk.class.php on line 125
[04-Sep-2020 21:26:27 UTC] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function Cache_Enabler_Disk::delete_asset(), 1 passed in /var/www/yourdomain.com/html/wp-content/plugins/bb-plugin/extensions/fl-builder-cache-helper/plugins/cacheenabler.php on line 13 and exactly 2 expected in /var/www/yourdomain.com/html/wp-content/plugins/cache-enabler/inc/cache_enabler_disk.class.php:125

You are most likely to encounter this issue with Multisite WordPress.

Temporary Resolution

Since there’s no real fix yet from either party, here’s the code change that is needed to temporarily resolve the conflict.

  • Open the bb-plugin/extensions/fl-builder-cache-helper/plugins/cacheenabler.php file. This file is part of the Beaver Builder plugin.
  • Navigate to line# 13 where there is a function call that looks something like this:
\Cache_Enabler_Disk::delete_asset( site_url() );
  • Change that line to add a second parameter to the delete_asset function call so that it looks like this:
\Cache_Enabler_Disk::delete_asset( site_url(),'dir' );

Save the file and you should be good to go.

Explanation of The Underlying Issue

The delete_asset function in the Cache_enabler plugin now requires two parameters. Originally it required one; but it seems in one of its recent updates it started to require two without setting a default for the second parameter.

This means that all calls to the delete_asset function will require two parameters. If the second one is not present, the PHP script will throw a hard error.

Beaver Builder only passes one of the parameters when saving a page which triggers the hard error. Therefore control is never returned to the Beaver Builder script and, by extension, the admin.

This fix should temporarily resolve the issue until the next Beaver Builder update (we’ve already notified them of the issue). Hopefully that update includes this fix. Otherwise you’ll need to apply it again.

And, if you see a similar error with another page builder (or other WordPress) plugin, you’ll just need to track down where the delete_asset function is being called and set the second parameter for it.

Update: 9/16/2020

We’ve noticed that upgrading BB can sometimes cause a white-screen crash – likely because it’s trying to clear the cache which triggers the issue.

Automatic Notification Of New Articles

Sign up to get automatic notifications of new articles.  This is a different list than our standard list - you only get new articles within 24 hours of publication.  No other emails will be sent unless you sign up for our general list in the footer of this site as well.

Posted in