bad Beaver Builder field sanitization callback
-
Issue summary
We tracked this down to a bad Beaver Builder field sanitization callback in the Timed Content module, not a problem with the date logic itself. The plugin’s bootstrap loads the actual module fromtimed-content-module/timed-content-module.phponly when Beaver Builder is present, so the failure was happening inside the module settings/save flow rather than in the loader file.
On save/publish, Beaver Builder was failing inFLBuilderModel::sanitize_settings()with:
Plain Text
call_user_func_array(): Argument #1 ($callback) must be a valid callback,
class "FLBuilderUtils::esc_tags" not found
Show more lines
This happened because the module registered the Expiry Message → Message Tag field with an invalidsanitizedefinition:
PHP
'sanitize' => array('FLBuilderUtils::esc_tags', 'h4'),
Show more lines
Beaver Builder’s custom module documentation says thesanitizefield should be a valid callable callback, for example a function name string, not an array in this format.
Why it broke
Beaver Builder interpreted that array as a PHP callback and attempted to call it during the module save process. Under current Beaver Builder / PHP behavior, that resolves as an invalid callback, which causes the module save / partial refresh / publish request to fatally fail. That is why the Timed Content fields appeared not to save or publish. Beaver Builder’s module documentation confirms thatsanitizemust be a proper callback used to sanitize field values during settings processing.
Fix
The fix was to replace the malformed sanitize definition with a real custom sanitizer callback, e.g.:
PHP
'sanitize' => 'bsfbb_timed_content_sanitize_tag',
Show more lines
and define a function that whitelists the allowed HTML tag values (h1–h6,div,span,p) and falls back toh4if the saved value is invalid. That matches Beaver Builder’s documented custom-module sanitization pattern.
I also added a small hardening improvement for the timezone setting so the module falls back safely toUTCiftime_zoneis empty, which helps reduce avoidable warnings under newer PHP versions. The module file is loaded only when Beaver Builder is active, which is the correct pattern for a class extendingFLBuilderModule
Result
After replacing the original module file with the patched version, the Timed Content module began saving and publishing correctly again. The standalone “Class FLBuilderModule not found” error seen when opening the module file directly is expected and not related to the save bug, because Beaver Builder module files are meant to be loaded inside WordPress/Beaver Builder, not run directly.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
You must be logged in to reply to this topic.