5efbe65d by Chris Boden

Fixed bug in WP_Option

1 parent db6017bc
......@@ -11,15 +11,18 @@ class WP_Option implements ArrayAccess, Countable {
$this->_ns = $ns;
$this->_data = get_option($ns);
$changed = false;
if (is_array($defaults)) {
foreach ($this->_data as $key => $val) {
$defaults[$key] = $val;
foreach ($defaults as $key => $val) {
if (!isset($this->_data[$key])) {
$this->_data[$key] = $val;
$changed = true;
}
}
}
if ($this->_data != $defaults) {
$this->_data = $defaults;
$this->save();
}
if ($changed) {
$this->save();
}
}
......