I have in my themes some code which will set a session variable. For the sake of example, it's a geolocation routine which will set to either USA, UK or ROW, resulting in:
$_SESSION['region'] = 'USA';
and I have a custom taxonomy of 'regionok' which any or all of the same terms are set.
I wish to use the session variable value as the taxonomy term to filter on.
The cleanest solution I can imagine would be to have a filter hook in my functions.php which would replace the placeholder term 'auto-region' with the session value before each query is executed. That way I can use widget plugins without having to hack them - I would just use the placeholder term in configuration. However, I don't know what the relevant hook would be.
(Other use cases would be session variables for family filter, referrer, etc. The geolocation example is entirely incidental.)