Which custom query am I in and how can I access its properties & methods?

First, don’t use is_main_query() function (method is ok). It tells something absolutely different from what you would think it does — was the main query overridden.

As far as I remember, there is no clean solution to this since WP doesn’t have a concept of explicitly passing context to a specific template or template part.

Since WP’s way hinges primarily on globals, the “fitting” (if dirty) approach might be to pass the information in same fashion — through a global variable(s) of your own.

Leave a Comment