我正在创建一个自定义设置面板,我的代码是
function custom_text_field_html(){
$text = get_option( \'homepage_text\' );
printf(
\'<input type="text" id="homepage_text" name="homepage_text" value="%s" />\',
esc_attr( $text )
);
}
function custom_checkbox_field_html(){
$checkbox = get_option( \'disabletitle_text\' );
printf(
\'<input type="checkbox" id="disabletitle_text" name="disabletitle_text" value="1" />\',
esc_attr( $checkbox )
);
}
我的复选框数据未保存,如何保存复选框数据,如“文本字段”,以便我可以在函数中调用它们,如果有人选中字段“启用该功能”,如果有人“未选中该字段”,则禁用该功能。我提到了这个http://qnimate.com/add-checkbox-using-wordpress-settings-api/, 但在我的情况下这是错误的