-
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 not working for checkboxes #1809
Comments
Same here. I was using 3.0.16 in my projects and it was fine. In the latest version some fields are displayed even if they shouldn't according to the active_callback rules. Nothing fancy with the config or the fields: trying to display / hide fields based on the switch (=checkbox) field value. |
Even I am experiencing the same issue. It was working fine earlier. |
fixed in the dev branch, will be included in v3.0.26 👍 |
Thanks a lot, @aristath! |
I've just checked the dev version and it's working fine again. Thank you! |
I'm afraid, I was too quick in my conclusions. The commit fixed the issue partially. There's still something wrong with the active_callback. It's not only the matter of checkboxes, but applies to multiple active_callback conditions.
I'm still seeing the Columns select field, even if Default Settings are active: And if I disable Default Settings and select the List (second option) type layout, I still see the Columns field, however it should be visible only if Masonry or Grid is selected: I would highly appreciate, if you could check the issue, @aristath. Thanks! |
Took me 4 hours, but I believe it's ok now. |
Awesome, it's working now! And looks like it's working much faster now. Many thanks, you're a ⭐️! I'm a little bit confused about this sentence though: It should be ok now no matter how many levels deep you go 👍 What do you mean by many levels? I thought there're only two levels in active_callback. The first level is with AND operator, while the nested levels are with OR operator. Or has this recently been changed in Kirki? |
* develop: (73 commits) fixes #1730 fixes #1830 GDPR: Load webfont-loader locally Update fonts fixes #1834 Apply WordPress Coding Standards Update kirki-helper-class.md see #1797 cleanup unused vars See #1807 Additional fix for #1809 fixes #1828 fixes #1808 fix #1814 fix #1797 fixes #1809 Update sortable.md fixes #1787 update webfonts & grunt changelog ... # Conflicts: # modules/postmessage/class-kirki-modules-postmessage.php
Actually it's alternating. For example you could do something like this if needed 'active_callback' => array(
array(
array(
'setting' => 'setting1',
'operator' => '==',
'value' => false,
),
// OR
array(
array(
'setting' => 'setting2',
'operator' => '==',
'value' => true,
),
// AND
array(
array(
'setting' => 'setting3',
'operator' => '==',
'value' => true,
),
// OR
array(
'setting' => 'setting4',
'operator' => '==',
'value' => true,
),
),
),
),
// AND
array(
array(
'setting' => 'setting5',
'operator' => '==',
'value' => true,
),
// OR
array(
'setting' => 'setting6',
'operator' => '==',
'value' => false,
),
),
), |
Thanks for explanation! Looks much more flexible now, though I can hardly image conditions with more than two levels. |
@aristath Can you please, add this explanation to your documentation too :) |
Issue description:
Hi @aristath,
active callbacks don't seem to work for checkboxes any more.
Version used:
3.0.25
Code to reproduce the issue (config + field(s))
The text was updated successfully, but these errors were encountered: