Title: Settings API with checkbox boolean input
Last modified: May 19, 2020

---

# Settings API with checkbox boolean input

 *  Resolved [pipfroschpress](https://wordpress.org/support/users/pipfroschpress/)
 * (@pipfroschpress)
 * [6 years ago](https://wordpress.org/support/topic/settings-api-with-checkbox-boolean-input/)
 * Hi, before yesterday I knew virtually nothing about the settings API.
    I knew
   how to set and retrieve options, but settings I knew nothing about.
 * In my first WP plugin in years (as in about a decade), I have it figured out 
   enough to adequately create the form in the settings panel but controlling what
   happens on submit I have not a clue.
 * The github is at the link that is only shown to logged in users.
 * Settings related functions are at lower end of `inc/functions.php` except for
   the one function that creates the form, which is in its own file `inc/options.
   php` as it has mixed html/php (which I loathe but will fix later, I really wish
   WordPress used DOMDocument but that is too radical of a change to expect)
 * The file “screenshot-1.jpg” there shows the visual output.
 * Three settings options (fourth will be added once these three are working)
 * The option values are binary so I am using a checkbox input.
 * Both the “name” and “id” attributes are identical to the name of the option that
   is set.
 * All of them have a `value="true"` but only have `checked="checked"` if the current
   option value is true.
 * That all works, but it seems on submit the processing of the data does not happen
   and I am certainly missing something that tells the settings API to set the option
   to boolean true if checked and boolean false if not checked.
 * Help?
 * When this is working, the plan is to add a fourth option allowing the user to
   select from a list of CDNs they can use (same list at code[dot]jquery[dot]com)
 * There probably already similar plugins but this seemed like a functional learning
   experience to create.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fsettings-api-with-checkbox-boolean-input%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Thread Starter [pipfroschpress](https://wordpress.org/support/users/pipfroschpress/)
 * (@pipfroschpress)
 * [6 years ago](https://wordpress.org/support/topic/settings-api-with-checkbox-boolean-input/#post-12863619)
 * I got it all figured out and working. Biggest problem was a typo, but that wasn’t
   the only issue.
 *  [Jonathan Heiman](https://wordpress.org/support/users/heimanj/)
 * (@heimanj)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/settings-api-with-checkbox-boolean-input/#post-13529813)
 * Do you have any advice on how to solve this issue? I am having the same problem.

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

The topic ‘Settings API with checkbox boolean input’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 2 participants
 * Last reply from: [Jonathan Heiman](https://wordpress.org/support/users/heimanj/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/settings-api-with-checkbox-boolean-input/#post-13529813)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
