Home › Forums › General Issues › Custom checkbox won't save to DB › Reply To: Custom checkbox won't save to DB
Other than that, the question is why isn’t is saving. It may be because you’re using a checkbox field, I’m not even sure what some of your settings are. For example 'toggle'
, seems to be a new setting on the checkbox field that I wasn’t aware of that lets you toggle all the choices on and off, but you only have one choice of “Yes”. It looks like you’re creating a “true/false” type of field so I’m a little lost tying to understand exactly what you’re doing.
If I was going to create a true/false field as a setting in another field then I would use a true/false type of field. I’ve just exported a true/false field from ACF to use as an example here.
acf_render_field_setting(array(
'default_value' => 0,
'message' => '',
'ui' => 1,
'ui_on_text' => 'On',
'ui_off_text' => 'Off',
'label' => 'test field',
'name' => 'test_field',
'type' => 'true_false',
));
If I’ve completely missed the mark with all of this let me know where I’m misunderstanding. To this point I have not had any problems creating custom settings for fields and having the values save when creating a new field so I’m really just guessing at why you’re seeing this given the information you’ve provided.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.