Protein that is covalently anchored to the peptidoglycan of a cell wall envelope. In Gram-positive bacteria, binding proceeds through a transpeptidation mechanism which requires a C-terminal sorting signal with a conserved LPXTG or LPXAG motif; an amide bond is created between the alpha-carboxyl group of the conserved threonine, alternatively alanine, and the amino group of peptidoglycan cross-bridges. In Gram-negative bacteria, binding proceeds through the formation of an isopeptide bond between the epsilon-amino group of a lysine and the alpha-carboxyl group of a peptidoglycan diaminopimelic acid.