I have several posts that contains some specific dynamic content that expects certain parameters that are stored in post's custom fields. The site uses self-developed plugin that uses global $post->ID to get the current post ID.
At the plugin init hook the global $post variable is not yet populated, so it's too early to retrieve the parameters stored in the custom fields. So at that stage I can just retrieve some plugin config parameters, nothing post-related.
What hook can I add to my plugin code that would be triggered when the global $post variable is available? I'd then populate a global array variable that is later used by plugin's shortcodes.
Another thing to take into account here is that there can be run-time errors when processing the post-specific data. In case of error, I'd like to redirect to an error page. So this means that I need to know the post ID before any content has started streaming to user's browser, otherwise the plugin can not perform http redirect to the error page.