Xylophagy is a term used in ecology to describe the habits of an herbivorous animal whose diet consists primarily (often solely) of wood.
Most such animals are arthropods, primarily insects of various kinds, in which the behavior is quite common, and found in many different orders.
[1] It is not uncommon for insects to specialize to various degrees; in some cases, they limit themselves to certain plant groups (a taxonomic specialization), and in others, it is the physical characteristics of the wood itself (e.g., state of decay, hardness, whether the wood is alive or dead, or the choice of heartwood versus sapwood versus bark).
[1] Many xylophagous insects have symbiotic protozoa and/or bacteria in their digestive system which assist in the breakdown of cellulose; others (e.g., the termite family Termitidae) possess their own cellulase.
Such insects often carry the spores of the fungi in special structures on their bodies (called "mycangia"), and infect the host tree themselves when they are laying their eggs.