If an option was not sent to options.php, pass null to update_option(), rather than trimming the null and converting it to an empty string. This provides better context for sanitize_option() while still storing what ends up being an empty string either way. see #16416.
git-svn-id: http://core.svn.wordpress.org/trunk@21849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7d7498f7ab
commit
8cbf331fa5
|
@ -139,14 +139,15 @@ if ( 'update' == $action ) {
|
||||||
if ( $unregistered )
|
if ( $unregistered )
|
||||||
_deprecated_argument( 'options.php', '2.7', sprintf( __( 'The <code>%1$s</code> setting is unregistered. Unregistered settings are deprecated. See http://codex.wordpress.org/Settings_API' ), $option, $option_page ) );
|
_deprecated_argument( 'options.php', '2.7', sprintf( __( 'The <code>%1$s</code> setting is unregistered. Unregistered settings are deprecated. See http://codex.wordpress.org/Settings_API' ), $option, $option_page ) );
|
||||||
|
|
||||||
$option = trim($option);
|
$option = trim( $option );
|
||||||
$value = null;
|
$value = null;
|
||||||
if ( isset($_POST[$option]) )
|
if ( isset( $_POST[ $option ] ) ) {
|
||||||
$value = $_POST[$option];
|
$value = $_POST[ $option ];
|
||||||
if ( !is_array($value) )
|
if ( ! is_array( $value ) )
|
||||||
$value = trim($value);
|
$value = trim( $value );
|
||||||
$value = stripslashes_deep($value);
|
$value = stripslashes_deep( $value );
|
||||||
update_option($option, $value);
|
}
|
||||||
|
update_option( $option, $value );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue