Title: Code executed twice
Last modified: August 21, 2016

---

# Code executed twice

 *  Resolved [dskowronski](https://wordpress.org/support/users/dskowronski/)
 * (@dskowronski)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/code-executed-twice/)
 * Hello,
 * 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.
 * Normally I use require_once for external script – and it works. But now script
   does not produce output – even file with `echo "OK";`
    When I changed require_once
   into require PHP complained about redeclaration of function. Quick way around
   is using `if (!function_exist('foo')){ function foo(){ ... } }`
 * My script downloads content from other website it’s quite slow and executing 
   it twice is really bad.
 * I beleive that there is something in wordpress core that checks content of article
   with executing [php_insert].
    I 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
 * Is there anything I can do not to execute code twice by modyfying only plugin?
 * [https://wordpress.org/plugins/insert-php/](https://wordpress.org/plugins/insert-php/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/code-executed-twice/#post-4791118)
 * dskowronski, there may be another plugin that scans the post. A social media 
   plugin, perhaps, or an SEO one. According to what you’ve told me, I’m thinking
   something is making the page load twice.
 * The procedure described at this support cycle
    [http://www.willmaster.com/support/forum/viewtopic.php?t=534](http://www.willmaster.com/support/forum/viewtopic.php?t=534)
   revealed that a Facebook plugin or extension was the culprit.
 * Let me know what you find out.
 * Will
 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/code-executed-twice/#post-4791215)
 * Because there has been no response, I’m assuming the original poster resolved
   the issue.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Code executed twice’ is closed to new replies.

 * ![](https://ps.w.org/insert-php/assets/icon-256x256.gif?rev=3523853)
 * [Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts](https://wordpress.org/plugins/insert-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-php/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-php/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/code-executed-twice/#post-4791215)
 * Status: resolved