The production site of gamma-rays in blazar jet is an unresolved problem. We present a method to locate gamma-ray emission region in the framework of one-zone emission model. From measurements of core-shift effect, the relation between the magnetic field strengths ($B'$) in the radio cores of jet and the distances ($R$) of these radio cores from central supermassive black hole (SMBH) can be inferred. Therefore once the magnetic field strength in gamma-ray emission region ($B'_{\rm diss}$) is obtained, one can use the relation of $B'$-$R$ to derive the distance ($R_{\rm diss}$) of gamma-ray emission region from SMBH. Here we evaluate the lower limit of $B'_{\rm diss}$ by using the criteria that the optical variability timescale $t_{\rm var}$ should be longer or equal to the synchrotron radiation cooling timescale of the electrons that emit optical photons. We test the method with the observations of PSK 1510-089 and BL Lacertae, and derive $R_{\rm diss}<0.15\delta_{\rm D}^{1/3}(1+A)^{2/3}\ $pc for PSK 1510-089 with $t_{\rm var}\sim$ a few hours, and $R_{\rm diss}<0.003\delta_{\rm D}^{1/3}(1+A)^{2/3}\ $pc for BL Lacertae with $t_{\rm var}\sim$ a few minutes. Here $\delta_{\rm D} $ is the Doppler factor and $A$ is the Compton dominance (i.e., the ratio of the Compton to the synchrotron peak luminosities).
Comment: 5 pages, 0 figures, accepted by ApJ