set-screen-option

Filters a screen option value before it is set.

Description

apply_filters( 'set-screen-option', (bool) $false, (string) $option, (int) $value ); 

The filter can also be used to modify non-standard [items]_per_page settings. See the parent function for a full list of standard options.

Returning false to the filter will skip saving the current option.

Parameters (3)

0. $false (bool) => false
Screen option value. Default false to skip.
1. $option (string)
The option name.
2. $value (int)
The number of rows to use.

Usage

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

Defined (1)

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

/wp-admin/includes/misc.php  
  1. $value = apply_filters( 'set-screen-option', false, $option, $value );