# Suppress 'author' field when 'useauthor=false' in biblatex

I would like to prevent biblatex from printing by (name of author) in the bibliography in only those cases where I have put OPTIONS = "useauthor=false" in the entry in the .bib file. I assume I can put a relatively straightforward command in my .tex preamble that will take care of this. Below a silly example:

\documentclass{article}
\usepackage{csquotes}
\usepackage[
bibstyle = authoryear,
citestyle = authoryear-comp,
sorting = nyt,
language = american,
abbreviate = false,
backend = biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{bible,
AUTHOR = "God",
EDITOR = "James, King",
TITLE = "The {H}oly {B}ible",
YEAR = "1611",
OPTIONS = "useauthor=false, useeditor=true"}
\end{filecontents}
\begin{document}
\noindent
Text \parencite{bible}.
\printbibliography
\end{document}

-

There are a bunch of ways you might do this; but a simple one (that doesn't involve fiddling with the bibliography drivers at all) is just to clear the author field if useauthor if false:

\AtEveryCitekey{\ifuseauthor{}{\clearname{author}}}
\AtEveryBibitem{\ifuseauthor{}{\clearname{author}}}
-

Redefine the byauthor bibmacro to do nothing.

\documentclass{article}
\usepackage{csquotes}
\usepackage[
bibstyle = authoryear,
citestyle = authoryear-comp,
sorting = nyt,
language = american,
abbreviate = false,
backend = biber]{biblatex}
\renewbibmacro*{byauthor}{}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{bible,
AUTHOR = "God",
EDITOR = "James, King",
TITLE = "The {H}oly {B}ible",
YEAR = "1611",
OPTIONS = "useauthor=false, useeditor=true"}
\end{filecontents}
\begin{document}
\noindent
Text \parencite{bible}.
\printbibliography
\end{document}

Compare the original version of byauthor:

\newbibmacro*{byauthor}{%
\ifboolexpr{
test \ifuseauthor
or
test {\ifnameundef{author}}
}
{}
{\usebibmacro{bytypestrg}{author}{author}%