Undefined array key “form_submit_label” with AJAX-on-change filters
Hi,
I’m seeing a repeatable PHP warning from the Filters element when its submit option is set to “Ajax on input change”. It remains present after updating to BeTheme 29.0.4, running on PHP 8.3.
Warning
PHP Warning: Undefined array key "form_submit_label" in wp-content/themes/betheme/functions/theme-shortcodes.php on line 5342
Steps to reproduce
- Add a Filters element connected to a query loop, with at least one taxonomy filter.
- Select “Ajax on input change” as the submit option.
- Leave the submit-button label unset. Its setting is hidden in this mode.
- Save and load the frontend page with PHP error logging enabled, ensuring the request reaches PHP rather than a full-page cache.
- Check the PHP error log.
The warning occurs on the initial page render, including ordinary and filtered page URLs. No manual button submission is required.
Apparent cause
The builder hides the form_submit_label setting when form_submit is auto-submit. The frontend stylesheet also hides the submit button:
.mfn-advanced-filters-auto-submit button.mfn-btn {
display: none;
}
However, sc_filters() still generates the button and accesses its potentially absent label:
$return .= '<button type="submit" class="mfn-btn">'.( esc_html($attr['form_submit_label']) ?? 'Search' ).'</button>';
The null-coalescing fallback is outside esc_html(), so the undefined array key is accessed before the fallback can protect it.
Suggested minimal patch
Apply the fallback before escaping:
$return .= '<button type="submit" class="mfn-btn">'. esc_html($attr['form_submit_label'] ?? 'Search') .'</button>';
Comments
Hi,
It will be fixed in the next update.
Best regards
Great, thanks