{"id":3388038,"date":"2013-01-22T10:13:04","date_gmt":"2013-01-22T10:13:04","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/settings-widgets-lost-when-connection-error-occurs\/"},"modified":"2016-08-20T20:49:57","modified_gmt":"2016-08-20T20:49:57","slug":"settings-widgets-lost-when-connection-error-occurs","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/settings-widgets-lost-when-connection-error-occurs\/","title":{"rendered":"Settings \/ widgets lost when connection error occurs"},"content":{"rendered":"<p>I would like to inform you that setting db_connection_error should be mandatory, as it may cause lots of problems for many people.<\/p>\n<p>We have noticed on our huge multisite network that if we don&#8217;t set this callback (to kill wp) and some &#8220;get_option&#8221; queries appear (while no database is available), plugin\/widget settings might get &#8220;deleted&#8221;.<\/p>\n<p>It happens like that because most plugins have this workflow:<\/p>\n<p>if(!get_option(&#8220;xxx&#8221;))<br \/>\nupdate_option(&#8220;xxx&#8221;, &#8220;default&#8221;);<\/p>\n<p>Since no database is available get_option returns null and it&#8217;s value might get updated if database becomes responsive by the time plugin wants to set default settings.<\/p>\n<p>https:\/\/wordpress.org\/extend\/plugins\/hyperdb\/<\/p>\n","protected":false},"template":"","class_list":["post-3388038","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/3388038","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/3388038\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=3388038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}