Looks like your validation argument is negative.
if ($foo != "") { //means if foo not equal to empty space
// do something when not empty
// here you are setting an error
} else {
// do something when empty
// here you are trying to do your normal operation
}
You are setting an error when you have data and then trying to process data when you have none.
try changing your !=
to ==
or change the order in which you process things in the if
Related Posts:
- Save and retrieve custom plugin options value
- How should I use register_setting, add_settings_section, & add_settings_field in my plugin’s options page?
- Custom plugin settings: clicking “save changes” does not display success message
- Is it ok to call get_option without hooks?
- Can’t get plugin settings page to save data
- Serialize data for wp options
- How to get specific setting by settings_fields()?
- Add Plugin options as subpage to Theme options page
- Show admin notice on incorrect value on form field
- Gathering and logging data from a plugin: how to do it without race conditions?
- Can I use register_settings and unregister_setting once the settings page has loaded?
- Update WP option by plugin
- How to save plugin custom settings page fields
- How to make sure settings are not lost when plugin is updated?
- wp_options not returning value for logged out users?
- How to save Setting pages data to the database?
- how to show new field if option selected?
- 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?
- How to store multiple instances of the plugin’s options for various shortcodes
- Option page not updating multiple records in settings api
- 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?
- update_option_{$option} not showing old value
- Updating options into the wp database performance
- Can deactivating a plugin sometimes “reset” settings within that plugin?
- How to retrieve the options from this options page?
- Allowed memory size exhausted problem
- Change the style of h1, h2, only in post entry
- Plugin getting Cannot modify header information errors
- How to add options to the plugin page?
- Saving widget options from class method
- How to prevent plugins from sniffing/stealing other plugins’ options?
- Default plugin config to override wp_options?
- How to automatically redirect to custom admin menu after plugin activation?
- get_option / wp_localize_script Not Working in OOP Plug In
- OceanWP settings are missing from Add New Post [closed]
- Change in one place the data about the company, which are placed on several pages
- Plugin scheduled event not working
- CMB2 – array_search or in_array from repeat_group and comma separated values
- How to reinstate previously saved option?
- How (or where) do I get wordpress plugin update download link?
- Adding option values as an array using a multi selectable select box
- Store plugin page content in wp_options?
- How to change php variable value using wp setting api
- Settings API Message Error is global
- Every time I save my plugin options it erases another plugin options
- 500 error when updating plugin option
- Changing plugin options from theme functions file?
- Adding a theme option to the admin that lets me turn on/off a javascript file
- How to make a textarea accept javascript in my settings apge?
- How do you add a settings page to another menu?
- Localise settings section headline
- Need to add/remove group of options and display them as rows
- Multisite Plugin – Access options (wp_options) on child sites
- How to get values from network settings panel?
- How to add a custom form to a plugin’s setting page
- update_option creates an option, which empties on a blog reload
- Using call_user_func() within add_settings_section() within a Class
- What is the most efficient way of adding additional functionaliy for admin only
- Color Picker UI in admin is not correct
- Editable select options in quick edit OR in plugin settings
- Save log for imports in WordPress database – options-table, custom post type or other place?
- Managing and deleting transients with dynamically generated transient names
- Problem with MEMCACHE and Redis with wp_options
- update_option_{$option} not working (do function after options are saved)
- Creating an array from form inputs before it is posted to the options database
- Multiple checkbox doesn’t work in wordpress settings api
- Changing the CSS with a plugin
- Load google font script based on optgroup label selected
- save short-code in my custom plugin settings problem missed something
- How do I render content from a wp_editor in a plugin setting field?
- Settings Fields not showing up in Submenu Page
- Plugin Options Page and Subpage
- Optimized PHP & WordPress settings for speed/performance?
- save multi-select input using update_option for plugin
- WP options plugin setting not saving the selected checkboxes
- Enable plugins that are “not supported”
- Admin Custom Login loses settings on Code and Data migration
- Echo custom admin field into a is_single()
- Protect WordPress option value
- How to detect if i am on plugin’s settings page
- Manual Backup – How to save to Firefox or Chrome (instead of IE which brings up popup I can’t get rid of)
- Registered sidebar area is not shown from plugin.
- why my wordpress dont have toolbar like, plugin, themes and other?
- Register setting on plugin activation
- Why is the WordPress update_option not working in this code?
- database – multiple wordpress installations using same database – can they share plugin settings?
- WordPress update plugin through Dashboard/Plugins displaying error
- Plugin option for input box validation
- Options page textarea to populate custom post select field
- How to create a new database table whenever user changes options
- WordPress Settings – Custom Button actions
- get_option return incorrect values
- get_option returning old value for non-admin users
- WordPress 4.1 plugin only save 1 field to database
- Creating a register settings class that supports extended classes
- Add a checkbox in plugin options page and make it actually work