Title: Checking checkbox
Last modified: August 20, 2016

---

# Checking checkbox

 *  [ken90](https://wordpress.org/support/users/ken90/)
 * (@ken90)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/checking-checkbox/)
 * Hi, I’m developing a WP theme and recently I’ve encountered a problem which is
   quite annoying. I have created a custom theme options page where users are able
   to use checkboxes and everything works fine, BUT let’s say I set default checkbox
   value to checked(1, true) and when I load options page it shows it’s checked,
   but wordpress is giving me a false value when I try to test it. It appears that
   unless I actually press “Save” button default values of checkboxes are not saved
   into database. Should I add a function which writes default checboxes values 
   to database if they’re not present or is there any other more elegant way?

Viewing 1 replies (of 1 total)

 *  [kevinhaig](https://wordpress.org/support/users/kevinhaig/)
 * (@kevinhaig)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/checking-checkbox/#post-2928430)
 * I set up an array with the defaults and then used a function to check if the 
   option is set in the database. If it is not set then I load the default. You 
   need to do something like that because new users will never have the database
   set up yet.

Viewing 1 replies (of 1 total)

The topic ‘Checking checkbox’ is closed to new replies.

 * 1 reply
 * 2 participants
 * Last reply from: [kevinhaig](https://wordpress.org/support/users/kevinhaig/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/checking-checkbox/#post-2928430)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
