(Very) unexpected results with admin_init


Back-story: This started as a simple proof of concept. I didn't like how traditional WP error messages worked. I didn't want to have to account for every validation condition and then assign a # to that. post_updated_messages and that whole mess.

Instead I opt'ed for using admin_notices. What I was wanting to do was that on save_post figure out what that problem were, build a string and then assign that value to a property in that method. The method for admin_notices would then pick that up and be able to display it.

It ain't happenin'.

Best I can tell, admin_init is firing twice. That is, I have a helper class I use to log stuff to debug. I have a log event (?) in the __construct and that fires twice. Within the first time the method attached to save_post runs. (Note: I log that). Then there's a second __constructing of the plugin's class. And then in the second run the admin_notices' method() goes.

I don't understand why (or how) the admin_init fires twice.

I hope I'm explaining this well. Basically, I want to pass values (via a property within the plugin class) from one method to the next. Simple enough, right? But for some reason I'm not able to get one contigious process. It's more like: go - save_post method - stop. Go - admin_notices - stop. I can send you the code if you want. It's raw but the files are all relative small and easy to follow.

Finally, I've run into this using instantWP (single-site) as well as a shared multi-site install on Dreamhost. BOTH of them are creating class instances, killing them (I presume) and then going again.

Thanks in advance for your help.


p.s. I've also tried using the base parent class detailed here:


That too didn't work. I would get my various instance in an array. I could see that working but then at some point...BOOM! All gone and it would do it again.