-
Notifications
You must be signed in to change notification settings - Fork 329
-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
active_callback: Maximum call stack size exceeded #1961
Comments
I don't believe this was ever working in previous versions if combined with other items... It can be either a valid callback, or an array or arguments. But not a combo of the 2... Can you please confirm that you had that working on a previous version when using both a callback and an array of arguments? |
Hi @aristath Yes, I can confirm this was working, I have a theme project which includes 3.0.15 (within the project), where we configured it like this. We could manage when returning a simple boolean too, instead of a PHP function, but that isn't working either. $conditional_display = x ? true : false;
'active_callback' => array(
array(
'setting' => 'other_setting',
'operator' => '==',
'value' => true,
),
$conditional_display
), |
I can confirm that this no longer works. In older versions there was a PHP implementation that was handling all field dependencies. However that implementation had a lot of bugs and was causing a lot of issues when using The bad news is that we can't really make this work the way it did unless we revert to the previous buggy implementation. The good news is that I just pushed a commit that will not throw any errors. However, it does that by removing the extra PHP conditions and only keep the field dependencies since these are implemented via JS. This fix will be included in v3.0.34 which will be released soon. Alternative solutions: 'active_callback' => function() {
$dependency_option = get_theme_mod( 'other_setting', true );
$other_condition = is_singular();
if ( true === $dependency_option && $other_condition ) {
return true;
}
return false;
}, If for some reason you need to keep compatibility with PHP 5.2 (which is the unfortunate case for Kirki) then you can just create a function like this: function custom_function_check_dependency() {
$dependency_option = get_theme_mod( 'other_setting', true );
$other_condition = is_singular();
if ( true === $dependency_option && $other_condition ) {
return true;
}
return false;
} and then use that function as a callback: 'active_callback' => 'custom_function_check_dependency', |
Thanks, we'll see how we can change this
Errors are a good thing, otherwise we would not know what went/is wrong 🙂 |
True... but if this was a theme that's live and used by a couple hundred users, then quite a few sites would be unable to access the customizer. |
Issue description:
Maximum call stack size exceeded at Object.checkCondition (field-dependencies.js?ver=3.0.33:103)
Version used:
3.0.33
Using theme_mods or options?
theme_mods
Code to reproduce the issue (config + field(s))
ex.
__return_false
worked fine like this in a previous version I worked with (3.0.15)If this behavior is changed, how should we approach multiple active_callbacks which are not depending on an option?
The text was updated successfully, but these errors were encountered: