# Biblatex: Suppressing urldate does not work (\clearfield)

I've read through alot of entries here with a similar topic (like here or here). The solution does not work for me and I'm kind of deperate now.

That's why I'm asking this question again: How do I suppress the urldate field in biblatex.

I am using Miktex with Biber 2.2.

### My MCE (adopted from here):

\documentclass{article}

\usepackage[style=authoryear-icomp]{biblatex}

\AtEveryBibitem{%
\ifentrytype{book}{
\clearfield{url}%
\clearfield{urldate}%
}{}
\ifentrytype{collection}{
\clearfield{url}%
\clearfield{urldate}%
}{}
\ifentrytype{incollection}{
\clearfield{url}%
\clearfield{urldate}%
}{}
}

\usepackage{filecontents}

\begin{filecontents}{test-lit.bib}
@book{Abook,
author = {AAAAbook, A.},
year = {2001},
title = {Alpha},
url = {tex.stackexchange.com},
}
@online{Bonline,
author = {BBBBonline, B.},
year = {2002},
title = {Bravo},
url = {tex.stackexchange.com},
}
@collection{Ccollection,
editor = {CCCCColletionEditor, C.},
year = {2002},
title = {Charlie},
url = {tex.stackexchange.com},
urldate = {2010-01-01},
}
@incollection{Dincollection,
author = {DDDDincollection, D.},
year = {2002},
crossref = {Ccollection},
title = {Delta},
url = {tex.stackexchange.com},
}
\end{filecontents}

\nocite{*}

\listfiles

\begin{document}

Abc.

\printbibliography

\end{document}


### My Document looks like this:

(source: ahschulz.de)

I am also confused that the urldate is mentioned in the last entry, but there is no urldate in the bib-File.

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Martin Schröder Nov 18 '15 at 17:52
• \clearfield{urlyear} should do it (date fields are broken apart internally, at which point only the date parts exists). The urldate in Dincollection is inherited from Ccollection via the crossref feature. – moewe Nov 18 '15 at 17:56
• You can use \AtEveryBibitem{% \ifboolexpr{ test {\ifentrytype{book}} or test {\ifentrytype{collection}} or test {\ifentrytype{incollection}} } {\clearfield{url}% \clearfield{urlyear}} {}} (modulo line breaks) – moewe Nov 18 '15 at 17:56
• Note that Marco Daniel's answer (here) uses the correct urlyear while the other answer uses urldate, the fact that there are quite some (accepted) answers out here that use urldate makes me think that this once worked, but doesn't any more. – moewe Nov 18 '15 at 17:59
• – moewe Nov 18 '15 at 18:03

According to the comments of moewe, urldate is split up into urlyear, urlmonth and urlday. Removing urlyear solves the problem.

This MCE works:

\documentclass{article}

\usepackage[style=authoryear-icomp]{biblatex}

\AtEveryBibitem{%
\ifentrytype{book}{
\clearfield{url}%
\clearfield{urlyear}%
}{}
\ifentrytype{collection}{
\clearfield{url}%
\clearfield{urlyear}%
}{}
\ifentrytype{incollection}{
\clearfield{url}%
\clearfield{urlyear}%
}{}
}

\usepackage{filecontents}

\begin{filecontents}{test-lit.bib}
@book{Abook,
author = {AAAAbook, A.},
year = {2001},
title = {Alpha},
url = {tex.stackexchange.com},
}
@online{Bonline,
author = {BBBBonline, B.},
year = {2002},
title = {Bravo},
url = {tex.stackexchange.com},
}
@collection{Ccollection,
editor = {CCCCColletionEditor, C.},
year = {2002},
title = {Charlie},
url = {tex.stackexchange.com},
urldate = {2010-01-01},
}
@incollection{Dincollection,
author = {DDDDincollection, D.},
year = {2002},
crossref = {Ccollection},
title = {Delta},
url = {tex.stackexchange.com},
}
\end{filecontents}

\nocite{*}

\listfiles

\begin{document}

Abc.

\printbibliography

\end{document}


Here is a simple solution: use the url=false option of biblatex package.

Citation from biblatex documentation:

url=true,false (default: true)

This option controls whether the url field and the access date is printed. The option only affects entry types whose url information is optional. The url field of @online entries is always printed.

## Code:

\documentclass{article}

\usepackage[style=authoryear-icomp,url=false]{biblatex}

\usepackage{filecontents}
\pagestyle{empty}

\begin{filecontents}{test-lit.bib}
@book{Abook,
author = {AAAAbook, A.},
year = {2001},
title = {Alpha},
url = {tex.stackexchange.com},
}
@online{Bonline,
author = {BBBBonline, B.},
year = {2002},
title = {Bravo},
url = {tex.stackexchange.com},
}
@collection{Ccollection,
editor = {CCCCColletionEditor, C.},
year = {2002},
title = {Charlie},
url = {tex.stackexchange.com},
urldate = {2010-01-01},
}
@incollection{Dincollection,
author = {DDDDincollection, D.},
year = {2002},
crossref = {Ccollection},
title = {Delta},
url = {tex.stackexchange.com},
}
\end{filecontents}

\nocite{*}

\listfiles

\begin{document}

Abc.

\printbibliography

\end{document}

• This will of course remove URLs for everything except @online. For a more fine-grained control one needs either \AtEveryBibitem{\ifentrytype{article}{\clearfield{url}\clearfield{urlyear}}{}} or some version of \AtEveryBibitem{\ifentrytype{article}{\togglefalse{bbx:url}}{}}. – moewe Nov 21 '15 at 13:47