You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that the fields "checkbox", "toggle" and "switch" don't save as boolean (true/false) inside of the database, instead as integers 1 or 0.
When using those field inside of the customizer, javascript does return them as boolean.
In other words, when using PHP, the fields return either as 1 or 0 and when using javascript, they return as true or false.
This becomes an issue when using strict comparison with === and needing to check the values between the currently saved PHP value and the changed value inside of the customizer using Javascript.
I only came across this, since Kirki has currently the issue with active_callback not working with postMessage, and I am implementing a workaround using https://make.xwp.co/2016/07/24/dependently-contextual-customizer-controls/. Because the fields "checkbox", "toggle" and "switch" don't save as boolean inside of PHP, the dependencies will break when loading the customizer the first time, since on first page load, it uses the database values retrived via PHP to determine if a field is hidden or shown.
Version used:
2.3.7 (stable WP.org version)
Using theme_mods or options?
theme_mods
The text was updated successfully, but these errors were encountered:
This has already been fixed in the develop branch, though it will take some time to release the next version 'cause it's a rewrite of some parts of the plugin to make it more modular.
I'll have to ask for your patience on this one for now until we can have version 2.4.0 ready for release.
Issue description:
I noticed that the fields "checkbox", "toggle" and "switch" don't save as boolean (true/false) inside of the database, instead as integers 1 or 0.
When using those field inside of the customizer, javascript does return them as boolean.
In other words, when using PHP, the fields return either as 1 or 0 and when using javascript, they return as true or false.
This becomes an issue when using strict comparison with === and needing to check the values between the currently saved PHP value and the changed value inside of the customizer using Javascript.
I only came across this, since Kirki has currently the issue with active_callback not working with postMessage, and I am implementing a workaround using https://make.xwp.co/2016/07/24/dependently-contextual-customizer-controls/. Because the fields "checkbox", "toggle" and "switch" don't save as boolean inside of PHP, the dependencies will break when loading the customizer the first time, since on first page load, it uses the database values retrived via PHP to determine if a field is hidden or shown.
Version used:
2.3.7 (stable WP.org version)
Using theme_mods or options?
theme_mods
The text was updated successfully, but these errors were encountered: