Introduce pre_update_option filter.

Filter is available in update_option() and allows to filter any option before its value is (maybe) serialized and updated.

see #27504.
props westonruter.


git-svn-id: https://develop.svn.wordpress.org/trunk@27815 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2014-03-28 13:56:44 +00:00
parent cc102fe0ff
commit 76a167ac5f

View File

@ -255,6 +255,17 @@ function update_option( $option, $value ) {
*/
$value = apply_filters( 'pre_update_option_' . $option, $value, $old_value );
/**
* Filter 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.
*/
$value = apply_filters( 'pre_update_option', $value, $option, $old_value );
// If the new and old values are the same, no need to update.
if ( $value === $old_value )
return false;