Better to avoid such a thing. The settings API has two “faces”, one the UI, and the other is handling the form submission. The form submission is handled on a different URL than the UI (/wp-admin/options.php
) and therefor your “user action” depended code will not run and the handling of storing the setting in the DB might fail.
You need to register properly all fields, and then you can use CSS or JS to show/hide the relevant UI.
Related Posts:
- Custom plugin settings: clicking “save changes” does not display success message
- How to get specific setting by settings_fields()?
- How to make sure settings are not lost when plugin is updated?
- How to save Setting pages data to the database?
- How to save the option’s new values plus old value without overwrite old one
- WordPress Boilerplate Plugin doesn’t see callback functions for add_settings_field and add_settings_section
- How do I add a textarea (multirow) option to my WordPress plugin?
- Validating values using Settings API?
- move setting data from wordpress api to codestar freamwork
- When to store store plugin options as a single database record?
- Where can I find a schema of wordpress plugin core architecture?
- How to Loop Plugin Option Field Set?
- How to find out if option exists but is empty?
- How should I use register_setting, add_settings_section, & add_settings_field in my plugin’s options page?
- How to handel multiple checkbox field in the admin settings page with Settings API
- How can I include a setting that has a variable number of values in a settings page using register_setting?
- Saving Plugin settings to the database
- How to fetch serialized data from wordpress options
- Get all options saved by another plugin
- Add a Custom Permalink option in the Permalink Admin Screen?
- Settings API – input always updates over validation
- add action wp_head not working
- Wp die causing 500 Internal Server Error?
- Why is the Settings API is not saving my array of options
- Can’t get plugin settings page to save data
- Default Plugin Settings Not Writing to Database
- Update Option Error: Notice: Undefined index
- Why this global array is returning NULL from a callback function
- Serialize data for wp options
- How can I add an options page for my class based plugin?
- Get plugin option in another PHP file
- Add Plugin options as subpage to Theme options page
- Show admin notice on incorrect value on form field
- php page not found for plugin options menu
- Checkbox conflict in my custom plugin admin page
- add tabs in rdp-plugin/includes/settings.php and get settings saved
- Change the display of Settings API (do_settings_sections)
- Redirect to another page using contact form 7? [closed]
- Settings API saved values not getting shown in the dropdownbox
- WordPress error: Options page Setting_ not found in the allowed options list
- update_option_{$option} not showing old value
- How to prevent plugins from sniffing/stealing other plugins’ options?
- get_option / wp_localize_script Not Working in OOP Plug In
- Update WP option by plugin
- How to save plugin custom settings page fields
- Need to add/remove group of options and display them as rows
- How to get values from network settings panel?
- wp_options not returning value for logged out users?
- Problem with MEMCACHE and Redis with wp_options
- Plugin Options Page and Subpage
- WP options plugin setting not saving the selected checkboxes
- Echo custom admin field into a is_single()
- Protect WordPress option value
- Why is the WordPress update_option not working in this code?
- How to create a new database table whenever user changes options
- Option page not updating multiple records in settings api
- Create Array from data in the OPTIONS table
- Saving an array to get_options
- Building a simple “settings” plugin to change textstrings on the home page
- My first plugin doesn’t save the data in options
- How to access values from your own settings page in javascript?
- Uninstall, Activate, Deactivate a plugin: typical features & how-to
- Best way to initiate a class in a WP plugin?
- Upgrade 4.5.2 to 4.5.3 deleting row in wp_options table
- How do you debug plugins?
- How to structure a plugin
- What’s the preferred method of writing AJAX-enabled plugins?
- Add multiple plugin directories
- What are the differences between WPINC and ABSPATH?
- How to add a shortcode button to the TinyMCE editor?
- Where do I put the code snippets I found here or somewhere else on the web?
- What Plugins Demonstrate Great WP Plugin Development? [closed]
- is_plugin_active function doesn’t exist
- ‘Global’ settings page for multisite plugin
- Delete WordPress plugin Repository
- Custom pages with plugin
- How to change a user’s password programatically
- “Error: Options Page Not Found” on Settings Page Submission for an OOP Plugin
- Is get_option function cached?
- Who are the most trusted plugin developers? [closed]
- How can I find plugins’ slug?
- List all sidebar names?
- What are the common security flaws I need to look for? [closed]
- How to add field for new site-wide option on Network Settings screen?
- Get plugin_dir_url() from one level deep within plugin
- Pass PHP variable to javascript
- Contact form 7 select box different value-text than content-text in option [closed]
- Where is the best place to use add_filter
- Can a developer adopt a plugin marked as “not updated in over 2 years”?
- Conditionally enqueue a widget’s script/stylesheet in HEAD (only when present on page!)
- What are the advantages to the Settings API?
- How to implement WordPress plugin update that modifies the database?
- What is difference between get_bloginfo(‘url’) and get_site_url()?
- Custom media upload content for inserting custom post shortcode
- Stop a plugin in the activation process when a certain WP version is not met then show error message in admin_notices action hook
- Where to store plugin settings fields
- How to Add a Third Level Sub Menu to the WordPress Admin Menu
- How to Add an Index to Plugin Database table
- Does the number of downloads displayed for a plug-in in the WordPress.org plug-in directory include automatic updates?
- how to create child WordPress plugin