很可能是\'default\' => TRUE
.
\'request_vendor_access\' => [
\'label\' => __(\'Request access to become an Artist\', \'ignitewoo_vendor_stores\'),
\'type\' => \'checkbox\',
\'required\' => FALSE,
\'class\' => [\'form-row-full vendor_stores_request_access\'],
\'clear\' => TRUE,
\'default\' => TRUE,
]
如果没有,也请尝试
\'default_value\' => TRUE,
或者不用
\'clear\'
.
根据您想要实现的目标,您可能还希望动态获取默认值。以便恢复用户的选择。大概get_option($option, $default)
是这里的正确选择(如果这是选项API表单)。
\'request_vendor_access\' => [
\'label\' => __(\'Request access to become an Artist\', \'ignitewoo_vendor_stores\'),
\'type\' => \'checkbox\',
\'required\' => FALSE,
\'class\' => [\'form-row-full vendor_stores_request_access\'],
\'clear\' => TRUE,
\'default\' => get_option(\'request_vendor_access\', TRUE),
]
或
\'request_vendor_access\' => [
\'label\' => __(\'Request access to become an Artist\', \'ignitewoo_vendor_stores\'),
\'type\' => \'checkbox\',
\'required\' => FALSE,
\'class\' => [\'form-row-full vendor_stores_request_access\'],
\'clear\' => TRUE,
\'default\' => isset(get_option(\'my_option\')[\'request_vendor_access\'] ? get_option(\'my_option\')[\'request_vendor_access\'] : TRUE,
]