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

  1. Add a Filters element connected to a query loop, with at least one taxonomy filter.
  2. Select “Ajax on input change” as the submit option.
  3. Leave the submit-button label unset. Its setting is hidden in this mode.
  4. Save and load the frontend page with PHP error logging enabled, ensuring the request reaches PHP rather than a full-page cache.
  5. 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

Sign In or Register to comment.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.