• Problem: I’ve found that init fires multiple times on my WP site. I found this out while searching for the cause of my session_id() being reset constantly (session_start() is hooked into the init hook), and I’ve added a separate test function to print out some text on init. Whenever the page loads, the test text is printed between 5 – 15 times in the debug log, all entries with different timestamps.

    I saw this post on Stack Overflow about this issue being caused by 404’s: http://stackoverflow.com/questions/4372596/wordpress-why-is-the-init-hook-invoked-multiple-times

    However, I’ve cleared up all of my 404 issues, and still the problem occurs. Does anyone have an idea as to where I can start looking to resolve the issue?

Viewing 1 replies (of 1 total)
  • Thread Starter lordofmeesi

    (@lordofmeesi)

    Bump for this.

    I’ve tried disabling all of the plugins, switching back to Twentyfourteen, and doing both at the same time.

    Still the problem remains. I tested it by adding a if (!session_id()) : session_start(); endif;function to the init hook for 2014, and printing out the session_id() in the header. Every time I go to a new page, a new session id shows. I added some error reporting code to print out the id and a message when the session starts, and it restarts regularly even when I am not changing pages.

    Help please? I have really no idea what could be causing this, any sort of insight would be appreciated.

Viewing 1 replies (of 1 total)
  • The topic ‘Init hook firing several times’ is closed to new replies.