From 1f4bbde4a267de97c282a823f339343e5bad731e Mon Sep 17 00:00:00 2001 From: rboren 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: http://svn.automattic.com/wordpress/trunk@1446 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index ac2a96aa3..527bdfbd9 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