Support » Plugin: OptionTree » [Plugin: OptionTree] Checkbox – how to default to checked?
4 years, 5 months ago
How can I force a checkbox to be checked by default in a metabox? Here’s my code below:
'id' => 'platform_link_target',
'label' => 'Link Target',
'desc' => 'Do you want the link to open in a new window?',
'std' => '',
'type' => 'checkbox',
'class' => '',
'choices' => array(
'label' => 'Yes',
'value' => '_blank'
Thanks in advance!
I have the same question.
I think you may have to use some jQuery for this. Add a CSS class when you create the option and then register a script to run in the admin section which takes care of checking the checkbox.
Well I don’t want to put that much work into it, I thought there might have been a default option I missed like ‘default’ => ‘true’ for example.
Thanks for the answer anyways Yojance!