In osteoporotic fracture-related infection (FRI), coordinated bone healing is compromised by cortical bone lysis and persistent bacterial colonization. Here, Li et al. report a dual-action nanocomposite bisphosphonates hydrogel for treatment of osteoporotic FRI that preserves cortical bone integrity and restores fracture healing.