humanmade / authorship

A modern approach to author attribution in WordPress.
GNU General Public License v3.0
66 stars 7 forks source link

#9 - WP_Query overrides #30

Closed johnbillion closed 3 years ago

johnbillion commented 3 years ago

The idea behind this filtering is:

  1. Hook into WP_Query as late as possible before it starts reading and acting upon its query vars
  2. If the query vars don't contain any that we're interested in (author_name and author at the moment) then return early
  3. Make note of the values of concerned query vars
  4. Convert their values to an appropriate tax_query and set it as a query var
  5. Hook into WP_Query as close as possible before the query hits the database
  6. Reset the query vars to their original values
  7. 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.

Fixes #9.