Using an electrochemical polymerization process, a copper hexacyanoferrate/ordered mesoporous carbon-modified glassy carbon electrode (CuHCF/OMC/GCE) was prepared. The performance of CuHCF/OMC was compared with that of CuHCF and the properties of the new material were improved. A sensor for sensitive detection of captopril was developed based on CuHCF/OMC-modified glassy carbon electrode. The composition and morphology of the as-prepared CuHCF/OMC products were characterized by energy-dispersive X-ray spectroscopy and scanning electron microscopy. The electrochemical behaviour and electrocatalytic performance of the CuHCF/OMC-modified glassy carbon electrode towards the oxidation of captopril were evaluated by cyclic voltammetry. Results showed that the CuHCF/OMC-modified electrode exhibits two well-defined redox peaks. The linear range for the detection of captopril was from 1.0 × 10–5 to 2.7 × 10–3 M, with a correlation coefficient of 0.999, and the detection limit was 1.2 × 10–6 M based on a signal-to-noise ratio of 3.