Filters the value of any existing option before it is retrieved.
Description
Returning a value other than false from the filter will short-circuit retrieval and return that value instead.
Parameters
$pre_optionmixed
The value to return instead of the option value. This differs from $default_value, 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).
$optionstring
Name of the option.
$default_valuemixed
The fallback value to return if the option does not exist. Default false.
144<?php145 * the option doesn't exist elsewhere in get_option().146 * Default false (to skip past the short-circuit).147 * @param string $option Name of the option.148 * @param mixed $default_value The fallback value to return if the option does not exist.149 * Default false.150 */151 $pre = apply_filters( 'pre_option', $pre, $option, $default_value );152153 if ( false !== $pre ) {154 return $pre;155 }156157 if ( defined( 'WP_SETUP_CONFIG' ) ) {
History
Introduced in 6.1.0. Unchanged from 6.7.7 through 7.1.0.