What processing is done by wordpress when a page is accessed that loads all contextual information into $post and other variables? and is it possible to trigger this process manually (or simulate it) so function calls have this context?
The reason I'm asking is because I have written a small plugin that allows users to call wordpress functions via Ajax.
The plugin works great with context-less functions. It has a big limitation however: calling a function via ajax loses the context information (e.g. $post) that the called function would otherwise have, had it been placed from within a template.
However, the ajax call does send across the HTTP Referrer information. I can easily extract the referrer info, so I know e.g. on which page the user is on. The problem is I'm not sure how to use it further. Any tips/ideas would be greatly appreciated.