Init hook called multiple times
-
Hi,
I am having a problem with wordpress, which is causing various emails to send multiple times from the wordpress install.
I have done some digging and testing and I think that maybe the issue is coming from the init hook being called multiple times.
I set up some code in the theme’s functions.php as follows:
add_action('init', 'test_hook'); function test_hook() { global $wpdb; $message = date("m/d/y H:i:s");; $wpdb->insert("pq_logs", array("message"=>$message), array("%s")); }
When this is run, it actually adds more than one database entry on each page load…and it seems to be somewhere between 1 and 8 times at random. This obviously means the init process is running more than once for some reason – and I am guessing the woocommerce order complete emails and others that are showing errors use init in some way.
The question is – why is init being loaded more than once?
Thanks
- The topic ‘Init hook called multiple times’ is closed to new replies.