If the new value and old value are the same, do not update the option in update_option().
git-svn-id: http://svn.automattic.com/wordpress/trunk@1446 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c5841b82a4
commit
1f4bbde4a2
|
@ -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