Abstract The 5–10 nm exciton diffusion distance for most organic semiconductors is much less than the particle size of 2D covalent organic frameworks (COFs). As a result, the local structure change in a small domain of COFs, rather than the whole particles, could effectively promote the charge transfer for photocatalysis. Herein, three‐component condensation is used to preparing four mixed imine‐ and thiazole‐linked donor‐acceptor (D–A) COFs. In contrast to four 100% imine COFs, four mixed ca. 90% imine‐ and 10% thiazole‐linked materials have 77–95% higher photocatalytic hydrogen peroxide (H 2 O 2 ) production rate in pure water and O 2 due to the more prolonged lifetime for excitation state. In particular, USTB‐10‐S exhibits the H 2 O 2 generation rate to 5041 µmol g −1 h −1 . Coupling with benzyl alcohol as sacrificial reagent, its H 2 O 2 production rate is further increased to 16152 µmol g −1 h −1 , much superior to most COF‐based photocatalysts. This work illustrates the proof‐of‐concept that the local structure change of COFs in a tiny amount is able to significantly enhance the charge separation and thus the photocatalytic performance, inspiring the development of defect engineering in the field of COFs.