Our results suggest that, in addition to its effects on bone, infection-induced OPG protects pancreatic β-cells by blocking RANKL-RANK signaling. Here, TNFSF11 is linked to infection.