pre_option_(option) filter-hook . WP 1.5.0
Filters the value of an existing option before it is retrieved.
The dynamic portion of the hook name, $option, refers to the option name.
Returning a truthy value from the filter will effectively short-circuit retrieval and return the passed value instead.
Usage
add_filter( 'pre_option_(option)', 'filter_function_name_3604', 10, 3 ); function filter_function_name_3604( $pre_option, $option, $default ){ // filter... return $pre_option; }
- $pre_option(mixed)
- The value to return instead of the option value. This differs from $default, which is used as the fallback value in the event the option doesn't exist elsewhere in get_option().
Default: false (to skip past the short-circuit) - $option(string)
- Option name.
- $default(mixed)
- The fallback value to return if the option does not exist.
Default: false
Changelog
Since 1.5.0 | Introduced. |
Since 4.4.0 | The $option parameter was added. |
Since 4.9.0 | The $default parameter was added. |
Where the hook is called
wp-includes/option.php 82
$pre = apply_filters( "pre_option_{$option}", false, $option, $default );
Where in WP core the hook is used WordPress
wp-includes/option.php 340
add_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
wp-includes/option.php 342
remove_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
wp-includes/option.php 298
add_filter( 'pre_option_show_avatars', '__return_true', 100 );
wp-includes/option.php 308
remove_filter( 'pre_option_show_avatars', '__return_true', 100 );
wp-includes/option.php 724
remove_filter( 'pre_option_template_root', array( $this, 'get_template_root' ) );
wp-includes/option.php 723
remove_filter( 'pre_option_stylesheet_root', array( $this, 'get_stylesheet_root' ) );
wp-includes/option.php 720
remove_filter( 'pre_option_template', array( $this, 'get_template' ) );
wp-includes/option.php 719
remove_filter( 'pre_option_stylesheet', array( $this, 'get_stylesheet' ) );
wp-includes/option.php 716
remove_filter( 'pre_option_current_theme', array( $this, 'current_theme' ) );
wp-includes/option.php 686
add_filter( 'pre_option_template_root', array( $this, 'get_template_root' ) );
wp-includes/option.php 685
add_filter( 'pre_option_stylesheet_root', array( $this, 'get_stylesheet_root' ) );
wp-includes/option.php 682
add_filter( 'pre_option_template', array( $this, 'get_template' ) );
wp-includes/option.php 681
add_filter( 'pre_option_stylesheet', array( $this, 'get_stylesheet' ) );
wp-includes/option.php 678
add_filter( 'pre_option_current_theme', array( $this, 'current_theme' ) );
wp-includes/option.php 378
add_filter( "pre_option_{$id_base}", array( $this, '_preview_filter' ) );
wp-includes/option.php 1982
add_filter( "pre_option_{$option_name}", array( $this, 'capture_filter_pre_get_option' ) );
wp-includes/option.php 2024
remove_filter( "pre_option_{$option_name}", array( $this, 'capture_filter_pre_get_option' ) );
wp-includes/option.php 415
add_filter( 'pre_option_gmt_offset', 'wp_timezone_override_offset' );
wp-includes/option.php 425
add_filter( 'pre_option_embed_autourls', '__return_true' );