pre_get_posts OR relation between taxonomy and author

When I implemented something similar for a company that needed multiple authors, we did much the same with an author taxonomy. But in that case, we didn’t use the original author field at all.

Basically, it’s not possible to create a standard WP_Query with author=X OR coauthor=Y using standard methods. You’d have to resort to direct SQL fiddling, which is problematic and prone to accidental breakage.

Using the coauthor taxonomy exclusively, however, it’s fairly trivial to make a tax_query which has coauthor IN (X,Y) very simply.

So no, it’s not really a workaround, it’s actually the best way to do it. The posts table is entirely geared towards a single author. If you need multiple authors, then special-casing one of them into that post_author field is actually the real WTF here, because why bother? It’s more sensible to use the taxonomy instead and allow a fully multi-connected coauthor system.

Leave a Comment