In Taiwan, food safety courses are taught to Grade 6 schoolchildren at elementary school. However, no report discussed the relationship and these changes among knowledge, attitudes, and practices concerning food safety in Taiwan before. Therefore, the aim of this study was to determine the association of food safety education with a combination of knowledge, attitude, and practice, the mediating effect of attitude in the relationship between knowledge and practice, and the moderating effect of location of school and chief buyer of household foods in the model. A validated questionnaire was administered to Grade 5 and 6 schoolchildren of 25 elementary schools in the Yunlin County, Taiwan. Of 822 questionnaires, 772 (94%) were completed without missing values or invalid answers. There were 405 (52.5%) and 367 (47.5%) schoolchildren in Grade 5 and 6, respectively. The results showed that grade was significantly associated with a combination of knowledge, attitude, and practice (Wilks’ λ = 0.958, p < 0.001), and grade was significantly positively associated with knowledge (β = 0.08, p < 0.001) and attitude (β = 0.12, p = 0.014) but not with practice (β = 0.05, p = 0.288). Additionally, knowledge not only directly affected practice (70.9%, p < 0.001) but also indirectly influenced practice via attitude (29.1%, p < 0.001). When schoolchildren studied in urban areas, the relationship between knowledge and attitude could be strengthened with a simple slope of 1.60 (SE = 0.15, p < 0.001). When a chief buyer of household foods was one of father and mother, the association between knowledge and practice could be strengthened with simple slopes of 1.31 (SE = 0.33, p < 0.001) and 0.60 (SE = 0.15, p < 0.001), respectively. In conclusion, it suggested that food safety education in the sixth grade could give the schoolchildren more knowledge, and attitude was a mediator of knowledge to practice regarding food safety. On top of that, location of school moderated the association between knowledge and attitude while chief buyer of household foods moderated the relationship between knowledge and practice.