WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am getting the error illegal string offset when creating a checkbox in the admin.

my code look like this.

<input  type="checkbox"  id="slideThre" name="custom_settings[checked]" value="1" <?php checked(1, $custom_options['checked']);?>/>

There is no error when I check the box and save. The error appear when I uncheck the box and save.

What could be wrong?


share|improve this question
This is more a PHP question, debug your code. – Wyck Jan 17 '13 at 0:31
up vote 2 down vote accepted

Checkboxes only send data when checked. When unchecked, there is no post (or get) data. You need to check if set using isset()

if (isset($_POST['custom_settings']['checked'])) { /* it was ticked */ }
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.