Not sure where you’re adding this functionality, but I don’t see anywhere in this code where you use the update_option() function. Above your form HTML you should check if the form has posted data, then update the option.
//Do nonce checking here and
$tweak = $_POST['tweakfunction1'] ? $_POST['tweakfunction1'] : '';
update_option('tweakfunction1', esc_html($tweak));
WordPress includes a function called checked() that checks against a certain value. Your input tag has no value attribute as well. I added it below with the checked function.
<input size="76" name="tweakfunction1" type="checkbox" id="tweakfunction1" <?php checked('foobar', get_option('tweakfunction1'));?> value="foobar" />
Related Posts:
- How to Create a Custom WordPress Install Package?
- Fallback when Transient API fails
- How to Save Different Settings Options Using Settings API and/or the Theme Optimizer
- Putting my site live
- Work flow for multiple developers
- Cannot save using register_setting
- Block properties, attributes and settings
- The issue of redirecting my site to a new domain
- Are transients garbage collected?
- How to get the Date Format and Time Format settings for use in my template?
- Add multiple custom fields to the general settings page
- Are all options loaded to memory on each request?
- How does object caching work?
- How to pass arguments from add_settings_field() to the callback function?
- How to use checkbox and radio button in options page?
- how to update serialized options programatically?
- How to pass variable to add_settings_section() callback?
- Performance with autoload and the options table
- What’s the difference between Options & Settings?
- Using widget options ‘outside’ the widget
- How to load WordPress on non WP page?
- Options for CDN with WordPress Including Supporting Plugins?
- Option to set static front page disappeared from admin reading settings
- How to set up default values for a plugin?
- Difference between Option_Group and Option_Name in Register_Settings
- Add on the fly tabs to plugin options
- Why does WordPress use serialize rather than json_encode for the options table? [duplicate]
- Plugin options will not save in database
- No option to allow search engines to index my site in WP 4.3
- How to update an ‘array’ option using wp-cli [duplicate]
- Plugin options autoloading
- Where should I use get_option in a plugin
- Settings API – creating reusable form elements?
- Settings API – changing add_settings_field() output?
- Confirmation before deleting plugin options via uninstall.php
- Efficient way of saving plugin options
- How To Provide Sub-Blogs Their Own Domain Names?
- Set WordPress settings programmatically
- Submenu pages delete settings from options array when saved
- Remove/unset options field from backend Settings->General?
- get_option() from another wordpress site
- How can I get all user options?
- store simple data in get_option()
- register_setting() vs add_option()
- Settings API – save an array of options as one setting (array_push?)
- Where to hook register_settings for Settings API when also want to update options outside of Settings API?
- Add_settings_field() parameterizing callback?
- How much string content can I store in an option?
- Multisite: setting theme and options when a new blog is created
- Set a Default Value for an Option?
- How to update widget from widget() function?
- Setting ‘autoload’ to ‘no’ with Settings API
- Custom editor field displaying HTML in Visual editor
- Making a configurable field translatable
- Why isn’t get_option array contents displaying?
- Define WordPress image size in img tag
- Serialized settings in rest api
- Save Theme Options (options.php) From The Frontend
- Editor role not saving settings page for custom post type
- get_option() is not working even db contains the corresponding option_name and option_value
- Can’t output do_settings_sections . Can’t understand why
- Set default options for inserting media
- Add custom meta box on Post page
- Settings API erases itself?
- checkbox with get_option not working
- Settings API – how to update multiple options manually?
- Single callback with multiple setting fields
- Proper use of option_page_capability_{$page_name}
- Settings API – how to update options manually?
- How to change the file upload directory on version 3.5?
- Which WordPress option stores the current active theme?
- On Install, which code sets the ‘home’ option?
- update_option method with support of utf8
- Any way to partition wp_options?
- How do I add a value to a wp_options option that is an array?
- how can I detect that option value has changed?
- Can I use a space in an option name/key?
- How to save WordPress Options as an array?
- update_option not working in stand-alone PHP script
- How to verify this checkbox is checked?
- How to display some settings for super admin user only using Settings API
- Best practice differences in DB options and wp-config between live, staging and local WordPress environments?
- Logout redirects to a broken page(home URL is omitted)
- What to use , set_transient, set_option or file system? [closed]
- Is there a limit to the number of options you can store in one settings field of wp_options?
- wp_user_roles and Advanced Manipulation
- clean wp_options table unused rows
- Settings API get_option best practices
- Custom theme options Radio inputs not saving
- Deploy pre-configured database
- How to use get_option() without any filter?
- How to add multiple checkbox elements to media attachments?
- Custom widget select options needs to stay selected after save
- Character Encoding for wp_options
- Access general settings trough wordpress files
- get_option & update_option for multiple input fields with same name
- Settings API: Change position of custom setting field
- Tab from Settings API resetting all options with INSERT INTO [closed]
- Clone plugins (and settings) to new installation?
- Getting settings saved two times in settings page with tab