If the new value and old value are the same, do not update the option in update_option().
git-svn-id: https://develop.svn.wordpress.org/trunk@1446 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
7de46f24c6
commit
9fcaf1faad
@ -320,6 +320,12 @@ function update_option($option_name, $newvalue) {
|
||||
global $wpdb, $cache_settings;
|
||||
$newvalue = $newvalue;
|
||||
$newvalue = trim($newvalue); // I can't think of any situation we wouldn't want to trim
|
||||
|
||||
// If the new and old values are the same, no need to update.
|
||||
if ($newvalue == get_settings($option_name)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$newvalue = $wpdb->escape($newvalue);
|
||||
$wpdb->query("UPDATE $wpdb->options SET option_value = '$newvalue' WHERE option_name = '$option_name'");
|
||||
$cache_settings = get_alloptions(); // Re cache settings
|
||||
|
Loading…
Reference in New Issue
Block a user