From 9fcaf1faade6115a1df8c95578da9c1256b56c92 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 24 Jun 2004 01:00:31 +0000 Subject: [PATCH] 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 --- wp-includes/functions.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index ac2a96aa33..527bdfbd9a 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -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