The standard thin accretion disk model predicts that the inner regions of alpha model disks, where radiation pressure is dominant, are thermally and viscously unstable. However, observations show that the bright X-ray binaries and AGN accretion disks, corresponding to radiation-pressure thin disks, are stable. In this paper, we reconsider the linear and local instability of accretion disks in the presence of a toroidal magnetic field. In the basic equations, we consider physical quantities such as advection, thermal conduction, arbitrary viscosity, and an arbitrary cooling function also. A fifth order diffusion equation is obtained and is solved numerically. The solutions are compared to non-magnetic cases. The results show that the toroidal magnetic field can make the thermal instability in radiation pressure-dominated slim disks disappear if ϕm≥0.3. However, it causes a more thermal instability in radiation pressure alpha disks without advection. Also, we consider the thermal instability in accretion disks with other values of the viscosity and obtain a general criterion for thermal instability in the long-wavelength limit and in the presence of a toroidal magnetic field.