A kind of photonic crystal magnetic field sensor is proposed and investigated numerically. The shoulder-coupled resonant cavity is introduced in the photonic crystal, which is infiltrated with magnetic fluid. Through monitoring the shift of resonant wavelength, the magnetic field sensing is realized. According to the designed infiltration schemes, both the magnetic field sensitivity and full width at half maximum increase with the number of infiltrated air holes. The figure of merit of the structure is defined to evaluate the sensing performance comprehensively. The best structure corresponding to the optimal infiltration scheme with eight air holes infiltrated with magnetic fluid is obtained.