A narrow pH-applicability range can impact the actual treatment efficiency of AOPs, so the application of a wide pH range in AOP technology has garnered significant attention. In this study, the Cl-doped g-C3N4 as a visible light catalyst to activate the peroxydisulfate (PDS) process, named Vis/Cl-g-C3N4/PDS, was developed for trimethoprim (TMP) degradation in a wide pH range of 3–11. Results show that the Vis/Cl-g-C3N4/PDS process exhibited degradation efficiencies for TMP that were 1.39 times and 7.74 times higher than those of the Vis/Cl-g-C3N4 process and the Vis/g-C3N4 process, respectively. The Vis/Cl-g-C3N4/PDS process perfectly achieved degradation rates of over 98 % for TMP within a wide pH range of 3–11. It concluded that the high efficiency of the Vis/Cl-g-C3N4/PDS process in degrading TMP over a wide pH range was caused by the two co-existing reactive oxygen species (ROS) generation mechanism pathways: the photocatalytic activation of PDS and the light-assisted hydrolysis of PDS. Moreover, after 3 h of illumination in the Vis/Cl-g-C3N4/PDS process, a degradation range of 85.7 %–97.8 % was demonstrated in various real water matrices including of tap water, secondary sedimentation tank effluent, surface water, and aquaculture water. This study provided practical significance for the practical application of AOPs in water environmental pollution control.