Support

Account

Home Forums General Issues Custom checkbox won't save to DB Reply To: Custom checkbox won't save to DB

  • The one great thing I’ve found when creating new field types, or adding settings to existing field types is that any field type already defined by ACF can be used as a setting field for another field type, or even itself for that matter. For example, the radio field in ACF uses ACF radio fields for settings and the ACF true/false field uses true/false fields for settings.

    What I generally to is create a field in ACF of the type I want to use and then get the export code and look at that and then just use the needed settings when I call render_field_settings().

    I have not actually used a true/false field for a setting. This field type uses a checkbox and even a repeater https://github.com/Hube2/acf-medium-editor.

    This example that I posted on github uses the ACF number field and it is also an example of having multiple fields in one wrapper but uses acf_render_field_setting(). I just copied how E created the fields for image size settings.

    I basically just dug through ACF to see how E does it. Take a look at any render_field_settings() methods in any of the existing ACF field types and you’ll find examples of how to add a true/false field as a field setting.