You should (and must for security) use validation function, that is part of Settings API. I don’t seem to see it in your code. There you should be able to simply pass empty value for option under circumstances it should be saved as disabled.
Of course you can also just use regular Options API functions to access and modify your settings directly, from any appropriate place in code.
Related Posts:
- Custom taxonomy admin description
- Disable the “Skip to Toolbar” tabbing accessibility feature
- my checkbox is not saving it’s value
- How to switch between two forms for visitor once admin logged in?
- Is Post-Form Resubmission somehow prevented in WordPress 4.2.2?
- How to create input page in WordPress admin panel?
- Where in WP can I check history or log of updates of plugins etc?
- How does admin-ajax.php work?
- Hide other users’ posts in admin panel
- Editor Styles and Typekit
- WordPress admin stylesheet
- Is it possible to create a WordPress tour? V3.3.1
- Securing Admin Accounts – Username Discovery
- Can an admin check passwords of registered users?
- Prevent author from changing their posts if admin has modified
- Showing WP_Error message with admin_notice action hook
- Set Featured Image programmatically (in admin) with JavaScript?
- Can I set a default dashboard layout for all users?
- Taxonomy/category hierarchy lost when editing posts [closed]
- Making the thumbnails in the backend Media section bigger
- How to remove “Super Admin” from All Users for those that are not a “Super Admin”?
- Customize the upload screen
- How to print the output of the get_num_queries function from frontend to backend?
- Javascript not working in admin
- Setting Login with User Name and Password default option for Jetpack Admin Login
- Downloading entire site locally with httrack
- add_submenu_page set for multiple roles [duplicate]
- Adminstering Large Number of WordPress Sites
- How To Create User Specific Admin User Pages?
- Adding markup to column text in “Edit Pages” admin page
- Disable HTML (Text) Tab in Post Editor
- Disable WP Editor for specific page templates
- Admin: global $post empty
- How to remove “publish metabox” from each post type
- Change home-url in dashboard
- Admin doesn’t have sufficient permissions to plugin’s page
- How to restrict the editors from viewing/editing pages created by admin?
- Admin multiple column sorting
- How do I add a contact form?
- Unable to login, old site with previous developer gone
- How to default display name to first name and last and disable the profile field
- Adding html format on tinymce visual editor
- Hide Pages on Edit Pages based on Capability (edit_others_pages)?
- How can I show the contents of only a few users
- WordPress ACL (folder + permissions)
- Editors change a permalink on an unpublished post, but only admins change a permalink on a post that has ever been published?
- Locked out of admin and some pictures don’t show after failed SSL installation
- How-to turn off mobile admin mode?
- How can I make the user names of commentors clickable links to the user’s profile from the admin comment screen?
- Grabbing the first image attached to a post and use it with the admin columns
- Keep Logged in Users out of Admin Panel
- Add Custom Script in Other Plugin’s Options page
- Is there a wp-config.php option or constant that I can set to allow me to download nightly / beta builds?
- I can’t access the login panel on my offline website
- Output the admin menu_position for each item
- Admin login not working
- WordPress custom admin functions security
- Adding and removing columns from the admin pages panel
- paginate_links on custom query in admin – ‘sufficient permissions’ error
- Live reload preview just reloads forever
- Hide admin notice when user profile updated
- WordPress Screen options does not show any fields
- Locked out of WordPress website from wrong amount of login attempts
- current_user_can(‘administrator’) not working in custom login
- Black admin bar is being hidden by page elements
- admin edit link from a specific page
- Set Link Target Checkbox chcked on Edit Image MOdal Window in Admin Post Edit Screen?
- Help! I changed the domain and now I can’t log in via admin online
- Username was changed to “admin”
- Admin user roles/permissions
- [Multisite]How can I update custom blog option?
- Top toolbar is not showing in wordpress admin panel
- wordpress – add a custom admin section with fields for name, address, city,state, and photo upload
- Problem with implenting Uploadify with WordPress
- Gutenberg UI has changed
- Call require_once form admin page with checkbox
- How To Remove Import/Export Option From Tools?
- Highlight active Admin Menu when added though add_menu_page
- Unable to access admin web page
- Error “Sorry, you are not allowed to access this page”
- Create WordPress Menu Item Without Linking to a Custom Page
- Search Only Works when Logged into Admin
- exclude ID on avatar
- Missing content on website. Admins cant sign in
- Different role for free and pro users in wordpress without using bbpress
- WordPress login not working
- Enqueue script throws error in console
- How to sort post_meta in edit.php?
- Scripts are not called until I login from wordpress backend
- Link to all posts page?
- WP Logs me out after updating anything on dashboard
- Adding additional text fields and image upload to a Page?
- Calculate and save an average in a meta
- If the only thing I use MySQL for is WordPress, do I need MySQL’s timezone tables?
- plugin to upload to youtube via wordpress [closed]
- How to fix: Clicking ‘Quick Edit’ link in Admin (edit.php) makes posts disappear?
- My Account Lost Administrator permission
- WordPress admin panel is blank
- Use the wordpress admin table
- deploying a standard build of wordpress in WHM/cPanel