Zoning ordinances shall encourage the continuity, development and viability of agricultural operations. Zoning ordinances may not restrict agricultural operations or changes to or expansions of agricultural operations in geographic areas where agriculture has traditionally been present unless the agricultural operation will have a direct adverse effect on the public health and safety. Nothing in this section shall require a municipality to adopt a zoning ordinance that violates or exceeds the provisions of the act of June 30, 1981 (P.L. 128, No. 43), known as the "Agricultural Area Security Law," the act of June 10, 1982 (P.L. 454, No. 133), entitled "An act protecting agricultural operations from nuisance suits and ordinances under certain circumstances," and the act of May 20, 1993 (P.L. 12, No. 6), known as the "Nutrient Management Act."
53 P.S. § 10709-A