Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Not using WordPress checked function? #139

turtlepod opened this Issue · 4 comments

5 participants


i just try this, very cool.

i try using check-box and i think it's better if:

  1. using checked function.

  2. save the vield with "1" and not "on"
    just like every admin checkbox in WordPress.

it's simple:
just change:

echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';


echo '<input type="checkbox" value="1" name="'.$field['id'].'" '. checked( ! empty( $meta ),true ,false ) .' />';

just a suggestion.



I completely agree. The issue now is just if and how to change so that it has some backwards compatibility. Or I suppose we could just not worry about that :P


i don't think backwards compability is an issue.
as long as user don't check if the meta field == 'on'. or something like that.
and i think WordPress read the value of "0" is the same as no field entry. (maybe, i'm not really sure)

(sorry for my english, it's not my native language)


could this apply to radios too????


I think that for backward compatibility it would be better to add an option where to set the value for selected checkbox.

Something like that:

                    'name' => __( 'My Field Label', 'textdomain' ),
                    'desc' => __( 'My Field description.', 'textdomain' ),
                    'id'   => $prefix . 'my_field',
                    'type' => 'checkbox',
                    'value' => '1', // Default 'on'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.