Hook into WP_Query as late as possible before it starts reading and acting upon its query vars
If the query vars don't contain any that we're interested in (author_name and author at the moment) then return early
Make note of the values of concerned query vars
Convert their values to an appropriate tax_query and set it as a query var
Hook into WP_Query as close as possible before the query hits the database
Reset the query vars to their original values
Allow the "modified" database query to run
It's likely that we'll need to tweak the priorities and possibly the filters used for maximum compatibility with other libraries that filter the query, particularly ElasticPress for example. This can come after further testing.
The idea behind this filtering is:
WP_Query
as late as possible before it starts reading and acting upon its query varsauthor_name
andauthor
at the moment) then return earlytax_query
and set it as a query varWP_Query
as close as possible before the query hits the databaseIt's likely that we'll need to tweak the priorities and possibly the filters used for maximum compatibility with other libraries that filter the query, particularly ElasticPress for example. This can come after further testing.
Fixes #9.