{"id":4790708,"date":"2014-04-09T14:22:18","date_gmt":"2014-04-09T14:22:18","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/code-executed-twice\/"},"modified":"2016-08-21T19:10:23","modified_gmt":"2016-08-21T19:10:23","slug":"code-executed-twice","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/code-executed-twice\/","title":{"rendered":"Code executed twice"},"content":{"rendered":"<p>Hello,<\/p>\n<p>I am using php_insert for long time but recently (probably after update to 3.8.2 but there is no way I can check it) my code started to be executed twice. <\/p>\n<p>Normally I use require_once for external script &#8211; and it works. But now script does not produce output &#8211; even file with <code>echo &quot;OK&quot;;<\/code><br \/>\nWhen I changed require_once into require PHP complained about redeclaration of function. Quick way around is using <code>if (!function_exist(&#039;foo&#039;)){ function foo(){ ... } }<\/code><\/p>\n<p>My script downloads content from other website it&#8217;s quite slow and executing it twice is really bad. <\/p>\n<p>I beleive that there is something in wordpress core that checks content of article with executing [php_insert].<br \/>\nI know PHP well but I do not have idea how to debug which function is guilty except reading source code of everything in \/wp-include<\/p>\n<p>Is there anything I can do not to execute code twice by modyfying only plugin?<\/p>\n<p>https:\/\/wordpress.org\/plugins\/insert-php\/<\/p>\n","protected":false},"template":"","class_list":["post-4790708","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4790708","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\/4790708\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=4790708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}