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
- ‘Global’ settings page for multisite plugin
- Contact form 7 select box different value-text than content-text in option [closed]
- Inherit plugin settings to new site in Multisite
- How to tell if plugin has been network activated
- How to find out if option exists but is empty?
- 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
- Network-Wide Plugin Settings Management
- How to create a Page alias in WordPress
- Some Plugin Settings Are Kept After Removal and Reinstall of the Plugin
- Plugin set default setting value when it activated
- Get all options saved by another plugin
- Stop the form of beign submitted on “Save changes” custom option page
- Custom options page checkbox will not save, despite working with text
- add function to saving change on Options Pages
- Is there a reliable way to keep track of how long a WordPress theme has been active?
- Restore a Plugin’s Default Settings
- add action wp_head not working
- Wp die causing 500 Internal Server Error?
- Default Plugin Settings Not Writing to Database
- Update Option Error: Notice: Undefined index
- Why this global array is returning NULL from a callback function
- Why slash is removed after domain?
- How to add a default value to get_option if it’s used as a variable?
- WordPress get_option and update_option returned entered on the textbox field
- Get plugin option in another PHP file
- Image upload and other options in the same plugin settings form?
- Most efficient way to use classes to create admin pages using Settings API
- How to remove traces from widget during uninstallation
- php page not found for plugin options menu
- Create tabs in admin options page from custom post type loop
- Enabling plugin failed because MySQL user do not have CREATE permissions
- options creation for plugins
- get_option error plugin development
- Settings API saved values not getting shown in the dropdownbox
- WordPress error: Options page Setting_ not found in the allowed options list
- How to retrieve the options from this options page?
- Allowed memory size exhausted problem
- Plugin getting Cannot modify header information errors
- Saving widget options from class method
- How to automatically redirect to custom admin menu after plugin activation?
- 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?
- Store plugin page content in wp_options?
- 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
- 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
- Problem with MEMCACHE and Redis with wp_options
- update_option_{$option} not working (do function after options are saved)
- Changing the CSS with a plugin
- Optimized PHP & WordPress settings for speed/performance?
- WP options plugin setting not saving the selected checkboxes
- Enable plugins that are “not supported”
- Registered sidebar area is not shown from plugin.
- why my wordpress dont have toolbar like, plugin, themes and other?
- 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
- get_option returning old value for non-admin users
- WordPress 4.1 plugin only save 1 field to database
- Unable to Retrieve Setting Value for my Plugin
- Plugin options not appearing on options page using tabbed navigation
- get Options value in “external” page
- how to protect wordpress website
- homepage olderposts link showing page not found
- WP e-commerce sales-view
- My first plugin doesn’t save the data in options
- Neither update_option nor delete_option fires in deactivation hook
- wp_options Table keeps growing