The Confucian Temple or Temple of Confucius of Shanghai (simplified Chinese: ?; traditional Chinese: ?; pinyin: ), is a folk Confucian temple in the old city of Shanghai. It is similar to the original temple of Confucius in his hometown Qufu and to the Beijing temple, but on a smaller scale. The temple is located on Wenmiao Road (?) in Huangpu District.
The Wenmiao Market lies around it. The market opens every Sunday morning and hosts a temple fair.
The Confucian Temple was first founded during the Yuan Dynasty, when Shanghai, once a small fishing village, was elevated to the status of a county seat. It was also the most prestigious learning institution of the county, as in ancient times a Confucian Temple was typically a combination of temple and school. In the following centuries, it was rebuilt several times. From 1851 to 1855, the temple was occupied by the Small Swords Society and became their headquarters. The temple was almost completely destroyed during the battle when government troops retook control of it. The government eventually decided to rebuild the temple at the present site.
The temple was badly damaged during the Cultural Revolution, but in 1995 it was designated for renovation by the local government. Now it is the site of one of the biggest book markets in Shanghai.