Filter
rpress_get_option
On this page
Filters the value returned by rpress_get_option() for any setting.
Runs on every rpress_get_option() call, after the stored value is read from the settings array. If the stored value is empty, the supplied default is already in place when the filter runs. The key-specific filter rpress_get_option_{$key} runs next.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$value | mixed | The stored value, or the default when the stored value is empty. |
$key | string | The option key. |
$default | mixed | The default passed to rpress_get_option(). |
Return value#
mixed. The option value.
Example#
function my_force_currency_option( $value, $key, $default ) {
if ( 'currency' === $key && defined( 'MY_STORE_CURRENCY' ) ) {
return MY_STORE_CURRENCY;
}
return $value;
}
add_filter( 'rpress_get_option', 'my_force_currency_option', 10, 3 );
Notes#
Runs on every option read, which is frequent. Keep callbacks light.
Source#
Applied in:
includes/admin/settings/register-settings.php(line 27), inrpress_get_option()
See also#
rpress_get_option_%7B%24key%7Drpress_get_settings
Was this page helpful?
