You want to manipulate and return the same input you have coming into the function. In your case that is $input
. That is how filters work.
function add_validation( $input ) {
// here I want to add some validation for a simple field named 'example'
if ( isset( $input['example'] ) && !empty( $input['example'] ) )
$input['example'] = wp_filter_nohtml_kses( $input['example'] );
return $input;
}
add_filter( 'theme_options_validate', 'add_validation' );
If you return something other than what you start with you will be overwriting everything that came before your filter. You can do if you want, just be aware that it is likely to break things.
Related Posts:
- wp_editor() fields on Theme Options Page not saving
- Getting error to display radio button value in General Settings page
- Settings API settings section not appearing
- How do I display a WP Option from an array?
- Can Settings API setting generate other settings?
- How to use checked() function with multiple check box group? How to properly sanitize that checkbox group?
- Can’t save multiple sections on one page with register_setting
- File input returns null in theme options array
- Can’t add options to db
- Theme options: Display ID of page options
- get_option() vs get_theme_mod(): Why is one slower?
- How to Use Checkbox in Custom Option Page Using The Setting API
- How do I add settings to the Background Options Page?
- Adding a checkbox to the theme customizer
- Adding a description to theme customizer controls
- Theme Options Panels, What are some good examples from Frameworks or Premium Themes? [closed]
- Where are a theme’s options stored and can I export them to be imported into freshly installed themes?
- Can I install Analytics before deciding on a theme?
- Options Framework options not being output
- Using update_option() and get_option() is echoing escaped strings
- Two Ways Of Creating WordPress Options Pages
- Theme Options page with tabs
- WordPress Nonce and check admin referer help needed
- Outputting results from select box option in options panel
- Theme option : having the ability to select among several predefined headers
- Upload multiple images via theme options [closed]
- How to add an export function to a custom Option Theme Page
- PHP stylesheet cannot use standard WP functions
- esc_url not working within add_settings_field callback
- Display user HTML on website
- Need help understanding/coding with Settings API
- Setting up a members area
- WordPress: update_option, don’t update empty options?
- How can one utilize a variable as a callback function name for add_settings_field
- Add a Custom Permalink option in the Permalink Admin Screen?
- Is it safe to post form data via Ajax to the settings api? Am I missing something?
- How can I show more than 15 themes at a time in the admin menu?
- How to create dependent field in Customizer?
- Which built-in WordPress files are safe to edit?
- How to add an alternative style sheet as a theme option?
- Disable image resizing on specific upload fields
- Put standard wordpress options into a theme options panel?
- How can I get my options in json response?
- Set the checkbox as checked by default at options page
- Removing \\\ from Saved Data
- How would you accomplish the following advanced settings page?
- Use of check_admin_referer with theme options and options.php
- WordPress custom options storing?
- WordPress admin panel framework weird layout on server side
- get option framework options returns Call to undefined function of_get_option()
- Update problem with update_option() in combination with register_setting()
- Theme Customizier sanitize_callback not working
- Getting the ID of header image, even when set to random
- Theme Options page not saving data correctly
- Create an Options page with two image upload fields
- Only allow site url in text field using wp_kses/wp_filter_nohtml_kses?
- Additional custom header image
- Modify Redux Framework Options in Child Theme
- Settings API – save multiple tabs at once
- Options Theme – WordPress [closed]
- How to reset (clear) theme settings
- Is there a function to add additional options to the Twentyeleven option page?
- How to save custom settings api fields with custom section fuction
- Remove Image Sizes in Media Settings Page
- How to set a default theme option after installing theme?
- How to get of_get_option() inside the inc folder file
- Retrieve uploaded image attibutes value from option tree theme options
- Category select options for plugin settings
- Issue on Checkbox with Custom Option Page
- Consequences if using PHP include TEMPLATEPATH?
- WordPress theme options framework, I can’t read them in my templates
- Color Options from Theme Customizer API not returning via get_theme_mod()
- Display and hide content using checkbox in Options Framework Theme
- How do I remove the page listing menu in the header in the Twenty Ten Theme?
- My title won’t update
- Multiple options in the options_value field of the wp_options table
- Shorter admin url for options page
- not getting API setting saved confirmation message after update on option page
- How to use WP Theme Option: Custom_Backgrounds on specific element?
- WP Page Options Array
- How can I create a rearrangeable list of items like OptionTree offers with the Theme Customization API?
- WordPress Theme Settings Page
- Theme options are they necessary
- Bring page from sub menu to admin menu in option tree
- The best place of the code for creating a robots.txt file
- Blogname and Blogdescription in Pagelines DMS Options Panel
- Cannot modify headers
- How to get functions.php to talk to options.php
- Options Framework not saving options correctly
- Admin menus and submenus
- Theme Options Page – Select, Radio, Tabs
- WordPress Options Framework, add to main menu not appearance menu
- Tabbed theme options query about add_settings_section callback function
- WordPress karma theme shortcodes not working
- WordPress built-in Custom Background
- Weird undefined index: id,std notices. How to fix it?
- Splitting an eCommerce store from the WordPress Theme
- Related Post Category Filter
- It is possible to pass $args that sent by add_settings_field() inside another function?
- How to register dynamic settings in WordPress Customizer?