Filter hook 'pre_update_option'

in WP Core File wp-includes/option.php at line 913

View Source

pre_update_option

Filter Hook
Description
Filters an option before its value is (maybe) serialized and updated.

Hook Information

File Location wp-includes/option.php View on GitHub
Hook Type Filter
Line Number 913

Hook Parameters

Type Name Description
mixed $value The new, unserialized option value.
string $option Name of the option.
mixed $old_value The old option value.

Usage Examples

Basic Usage
<?php
// Hook into pre_update_option
add_filter('pre_update_option', 'my_custom_filter', 10, 3);

function my_custom_filter($value, $option, $old_value) {
    // Your custom filtering logic here
    return $value;
}

Source Code Context

wp-includes/option.php:913 - How this hook is used in WordPress core
<?php
 908  	 *
 909  	 * @param mixed  $value     The new, unserialized option value.
 910  	 * @param string $option    Name of the option.
 911  	 * @param mixed  $old_value The old option value.
 912  	 */
 913  	$value = apply_filters( 'pre_update_option', $value, $option, $old_value );
 914  
 915  	/*
 916  	 * If the new and old values are the same, no need to update.
 917  	 *
 918  	 * Unserialized values will be adequate in most cases. If the unserialized

PHP Documentation

<?php
/**
	 * Filters an option before its value is (maybe) serialized and updated.
	 *
	 * @since 3.9.0
	 *
	 * @param mixed  $value     The new, unserialized option value.
	 * @param string $option    Name of the option.
	 * @param mixed  $old_value The old option value.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/option.php
Related Hooks

Related hooks will be displayed here in future updates.