{"id":4991513,"date":"2014-06-09T06:41:06","date_gmt":"2014-06-09T06:41:06","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/bug-wp_localize_script\/"},"modified":"2016-08-21T21:21:55","modified_gmt":"2016-08-21T21:21:55","slug":"bug-wp_localize_script","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/bug-wp_localize_script\/","title":{"rendered":"Bug &#8211; wp_localize_script"},"content":{"rendered":"<p>Does not match the data type, the second argument wp_localize_script:<\/p>\n<pre><code>$sh_settings = array_merge( array(\n\t\t\t&#039;unsaved_changes_txt&#039; =&gt; __(&#039;Some changes have not been saved.&#039;, &#039;syntax-highlight&#039;)\n\t\t\t), $sh_settings);\n\t\twp_localize_script( $this-&gt;js_handle, &#039;shSettings&#039;, $sh_settings);<\/code><\/pre>\n<p>Fix:<\/p>\n<pre><code>if(is_array($sh_settings)) {\n            $sh_settings = array_merge(array(\n                &#039;unsaved_changes_txt&#039; =&gt; __(&#039;Some changes have not been saved.&#039;, &#039;syntax-highlight&#039;)\n            ), $sh_settings);\n        }else{\n            $sh_settings= array();\n        }<\/code><\/pre>\n<p>https:\/\/wordpress.org\/plugins\/syntax-highlight\/<\/p>\n","protected":false},"template":"","class_list":["post-4991513","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4991513","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\/4991513\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=4991513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}