pre_update_option_{$option}
Filter HookDescription
Filters a specific option before its value is (maybe) serialized and updated. The dynamic portion of the hook name, `$option`, refers to the option name.Hook Information
File Location |
wp-includes/option.php
View on GitHub
|
Hook Type | Filter |
Line Number | 902 |
Hook Parameters
Type | Name | Description |
---|---|---|
mixed
|
$value
|
The new, unserialized option value. |
mixed
|
$old_value
|
The old option value. |
string
|
$option
|
Option name. |
Usage Examples
Basic Usage
<?php
// Hook into pre_update_option_{$option}
add_filter('pre_update_option_{$option}', 'my_custom_filter', 10, 3);
function my_custom_filter($value, $old_value, $option) {
// Your custom filtering logic here
return $value;
}
Source Code Context
wp-includes/option.php:902
- How this hook is used in WordPress core
<?php
897 *
898 * @param mixed $value The new, unserialized option value.
899 * @param mixed $old_value The old option value.
900 * @param string $option Option name.
901 */
902 $value = apply_filters( "pre_update_option_{$option}", $value, $old_value, $option );
903
904 /**
905 * Filters an option before its value is (maybe) serialized and updated.
906 *
907 * @since 3.9.0
PHP Documentation
<?php
/**
* Filters a specific option before its value is (maybe) serialized and updated.
*
* The dynamic portion of the hook name, `$option`, refers to the option name.
*
* @since 2.6.0
* @since 4.4.0 The `$option` parameter was added.
*
* @param mixed $value The new, unserialized option value.
* @param mixed $old_value The old option value.
* @param string $option Option name.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/option.php
Related Hooks
Related hooks will be displayed here in future updates.