admin管理员组文章数量:1404597
To understand the Settings API I'm creating a custom settings page for a custom plugin. I have some trouble to save the settings, I have a single checkbox to test if the code works well, but if I check it and then click save button it will not be saved and didn't remain checked. What's wrong with the code? Is possible to use the -
caratchers for the ID of a settings field or section?
register_setting(
'general', // Settings section ID
'show-countdown' // Settings field ID - maybe the problem?
);
The code for the checkbox is the following.
<input type="checkbox" class="" id="show-countdown" name="show-countdown" value="1" <?php checked(1, get_option('show-countdown'), false); ?> />
<label for="show-countdown"><?php echo $args[0]; ?></label>
NB: the register_settings_section()
and register_settings_field()
are working fine, this is why I omit the code.
本文标签: phpregistersetting not save checkbox
版权声明:本文标题:php - register_setting not save checkbox 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744837870a2627741.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论