We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$my_meta->addCheckbox('1_checkbox_field_id',array('name'=> 'My Checkbox 1')); $my_meta->addCheckbox('2_checkbox_field_id',array('name'=> 'My Checkbox 2')); $my_meta->addCheckbox('3_checkbox_field_id',array('name'=> 'My Checkbox 3')); $my_meta->addCheckbox('4_checkbox_field_id',array('name'=> 'My Checkbox 4'));
I would like to set default value for these boxes. How this should be written ?
Tried following ways: 'std'=> 'checked' 'std'=> "checked" 'std'=> checked 'std'=> 'true' 'std'=> "true" 'std'=> true
After I disable or enable checkbox the value won't save.
Edit: 'std'=> false - save function works fine but only when I set it to "false". If i type here "true" it won't save the value.
For example: $my_meta->addCheckbox('1_checkbox_field_id',array('name'=> 'My Checkbox 1', 'std'=> true));
In the admin panel I can see checked box, seems to be working but when i try to uncheck the box and save the value will rollback to "true" (checked)
The text was updated successfully, but these errors were encountered:
Maybe you should try addCheckboxList instead. https://github.com/bainternet/My-Meta-Box/blob/master/class-usage-demo.php#L94
addCheckboxList
Sorry, something went wrong.
closed in favor of #102
No branches or pull requests
$my_meta->addCheckbox('1_checkbox_field_id',array('name'=> 'My Checkbox 1'));
$my_meta->addCheckbox('2_checkbox_field_id',array('name'=> 'My Checkbox 2'));
$my_meta->addCheckbox('3_checkbox_field_id',array('name'=> 'My Checkbox 3'));
$my_meta->addCheckbox('4_checkbox_field_id',array('name'=> 'My Checkbox 4'));
I would like to set default value for these boxes. How this should be written ?
Tried following ways:
'std'=> 'checked'
'std'=> "checked"
'std'=> checked
'std'=> 'true'
'std'=> "true"
'std'=> true
After I disable or enable checkbox the value won't save.
Edit:
'std'=> false - save function works fine but only when I set it to "false". If i type here "true" it won't save the value.
For example:
$my_meta->addCheckbox('1_checkbox_field_id',array('name'=> 'My Checkbox 1', 'std'=> true));
In the admin panel I can see checked box, seems to be working but when i try to uncheck the box and save the value will rollback to "true" (checked)
The text was updated successfully, but these errors were encountered: