• i believe that the options.php script is either not getting ‘0’ (from an admin options form) or not setting ‘0’ for unchecked checkboxes within the script.
    and thus calling update_options without the zero value for the checkbox.

    im using an array to store multiple values in one option. otherwise works great when all checkboxes are checked or ‘1’.

    .

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Can you be more explicit here? Like is this happening with default options or something new you added via a plugin?

    Thread Starter adrianboston

    (@adrianboston)

    im 99% certain this is a form problem with null checkboxes and not a WP problem.

    and solved it as such,

    <label><input name="isenabled" type="hidden" value="0" ><input name="isenabled" type="checkbox" value="1" <?php if (isset($options['isenabled'])) { checked('1', $options['isenabled']); } ?> /> On</label>

    (as noted, using an array $options for options)

    in other words, consider it solved

    Thread Starter adrianboston

    (@adrianboston)

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    I get that it’s a problem with null checkboxes, but what I don’t get is WHERE you’re seeing it 🙂 You said it’s not WP, but if it’s WP that’s putting this out, we need to address it.

    Is this something you made on your own?

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘bug with options.php script for checkbox with '0' value’ is closed to new replies.