Molecular switches based on functionalized graphene nanoribbons (GNRs) are of great interest in the development of nanoelectronics. In experiment, it was found that a significant difference in the conductance of an anthraquinone derivative can be achieved by altering the pH value of the environment. Building on this, in this work we investigate the underlying mechanism behind this effect and propose a general design principle for a pH based GNR-based switch. The electronic structure of the investigated systems is calculated using density functional theory and the transport properties at the quasi-stationary limit are described using nonequilibrium Green’s function and the Landauer formalism. This approach enables the examination of the local and the global transport through the system. The electrons are shown to flow along the edges of the GNRs. The central carbonyl groups allow for tunable transport through control of the oxidation state via the pH environment. Finally, we also test different types of GNRs (zigzag vs. armchair) to determine which platform provides the best transport switchability.