Outside the breeding season the hoopoe's uropygial gland produces ordinary preen oil. In breeding females and nestlings the secretion turns dark brown and pungent, and the gland houses dense populations of Enterococcus bacteria that produce bacteriocins.
Experiments in which the secretion was applied to eggshells found reduced growth of feather-degrading and eggshell-penetrating bacteria, and higher hatching success compared with untreated eggs. The birds smear the oil onto the eggs and plumage, so the symbiont is being deployed rather than merely tolerated. The strong odour of an active hoopoe nest owes something to this secretion and something to accumulated droppings.
Nestlings can also eject faeces forcefully towards an intruder, adding to the defence. How the bacterial symbionts are acquired between generations, and how stable the community is across populations, is still under investigation. The hoopoe's crest is usually held flat and raised only briefly on landing or in alarm.

