sanitize_option_<option_name>

The WordPress Core sanitize option name hook.

Description

add_filter( 'sanitize_option_<option_name>', (unknown) $args_sanitize_callback ); 

Parameters (1)

0. $args_sanitize_callback (unknown)
The args sanitize callback.

Usage

To run the hook, copy the example below.
  1. $args_sanitize_callback = apply_filters( 'sanitize_option_{$option_name}', $args_sanitize_callback ); 
  2.  
  3. if ( !empty( $args_sanitize_callback ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the sanitize_option_<option_name> callback 
  2. function filter_sanitize_option_option_name( $args_sanitize_callback ) { 
  3. // make filter magic happen here... 
  4. return $args_sanitize_callback
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( "sanitize_option_{$option_name}", 'filter_sanitize_option_option_name', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( "sanitize_option_{$option_name}", 'filter_sanitize_option_option_name', 10, 1 ); 

Defined (3)

The filter is defined in the following location(s).

/wp-includes/option.php  
  1. add_filter( "sanitize_option_{$option_name}", $args['sanitize_callback'] ); 
  1. remove_filter( "sanitize_option_{$option_name}", $deprecated ); 
  1. remove_filter( "sanitize_option_{$option_name}", $wp_registered_settings[ $option_name ]['sanitize_callback'] );