Filters the value of an existing option.
Description
The dynamic portion of the hook name, $option
, refers to the option name.
Parameters
$value
mixed- Value of the option. If stored serialized, it will be unserialized prior to being returned.
$option
string- Option name.
Source
return apply_filters( "option_{$option}", maybe_unserialize( $value ), $option );
Quick tip for disabling a plugin at run time using the ‘active_plugins’ option:
Please note: this filter hook does NOT run when the option does NOT exist in the database. So it can only be used to filter existing options, not to filter the
false
response when there is no option found. For that, you’ll need the hookdefault_option_{$option}
Example migrated from Codex:
For example, to filter the blog description, you may use
option_blogdescription
.In the following sample code, we change the blog description on archive pages to include a page number (i.e. changing to “Example description. Page 2“). This is a common usage scenario to avoid duplicate meta description error in Google Webmaster Tools.