I have a widget (it is actually in the MailPress plugin) that writes style tags into the body of the page. Obviously that is very wrong, but the question is, can the widget write to the page header?
So far as I can see, the wp_head action is fired before the widget is displayed. It is fired before we even know whether the widget will be displayed on the page. That's what have observed.
However - is this really the way it works? Is the page head content really generated before the details of the page body content? Is there any way around this?
It makes sense to me for any CMS to hold off generating the head until it has fully generated the body. Only then would it truly have a list of what is needed in the head.
Is my only solution to include everything that any possible widget will need in the head of every page, just in case it is needed?