Wang Yan () (899–926), né Wang Zongyan (王宗衍), courtesy name Huayuan (化源), also known in historiography as Houzhu of Former Shu (前蜀後主; "last lord of Former Shu"), later posthumously created the Duke of Shunzheng (順正公) by the Later Tang dynasty, was the second and final emperor of China's Former Shu dynasty during the Five Dynasties and Ten Kingdoms period. He was the youngest son of founding emperor Wang Jian (Emperor Gaozu), but became his heir because his mother Consort Xu was Wang Jian's favorite concubine and was able to gain the support of the chancellor Zhang Ge.
Wang Yan's reign was traditionally considered one of decadence, corruption, and incompetence. In 925, his state was conquered by its northeastern neighbor Later Tang. Wang Yan surrendered to the Later Tang army, but was later killed by Emperor Zhuangzong of Later Tang.
Background.
Wang Zongyan was born in 899, during the reign of Emperor Zhaozong of Tang, as the youngest of the 11 sons of Wang Jian, who was then a major warlord late in the Tang dynasty as the military governor ("jiedushi") of its Xichuan Circuit (西川, headquartered in modern Chengdu, Sichuan), ruling over modern Sichuan and Chongqing. His mother was Lady Xu, a daughter of the official Xu Geng (徐耕) and a concubine of Wang Jian's, who became his favorite. (Her younger sister was also a concubine of Wang Jian's; therefore, later when they became imperial consorts, she was known as Consort Xu the Greater, while her sister was known as Consort Xu the Lesser.) It was said that Wang Zongyan was capable in literature even in his young age, capable of writing poems.
In 907, after the Tang throne was usurped by another major warlord, Zhu Quanzhong the military governor of Xuanwu Circuit (宣武, headquartered in modern Kaifeng, Henan), who established his own Later Liang as its Emperor Taizu, Wang Jian, who did not recognize the Later Liang emperor, declared himself the emperor of a new state of Shu (historically known as Former Shu). In 910, Wang Jian created all of his sons (except his second Wang Yuantan, whom he had earlier created Crown Prince) to be imperial princes, and Wang Zongyan was created the Prince of Zheng.
In 913, Wang Yuantan (whose name had been changed to Wang Yuanying by that point), in a power struggle with the senior official Tang Daoxi, started a military confrontation with Tang and killed him, but was then himself killed. The official Pan Kang urged Wang Jian to quickly create a new crown prince, and Wang Jian initially considered selecting either Wang Zonglu (王宗輅) the Prince of Ya, whom he considered most like himself, and Wang Zongjie (王宗傑) the Prince of Xin, whom he considered the most talented. However, Wang Zongyan's mother Consort Xu wanted Wang Zongyan to be created crown prince. She thus entered into an alliance with Tang Wenyi (唐文扆) the overseer of the imperial stables and the chancellor Zhang Ge. Zhang falsely informed a number of high-level officials, including the senior general (Wang Jian's adoptive son) Wang Zongkan (王宗侃), that Wang Jian had settled on Wang Zongyan but wanted their public support. He then drafted a petition to have Wang Zongyan made crown prince, and had Wang Zongkan and the others sign the petition. When Wang Jian received the petition, believing that Wang Zongyan did have the high-level officials' support, he, despite his doubts about Wang Zongyan's abilities, created Wang Zongyan crown prince.
As crown prince.
It was said that as crown prince, Wang Zongyan spent time with wine, women, and games. Whenever Wang Jian went past Wang Zongyan's palace and heard the sounds of Wang Zongyan staging cockfights or ballgames with the other princes, he would lament, "I fought 100 battles to establish this foundation; can people like this hold firm on it?" He therefore came to despise Zhang Ge greatly, but as Zhang was protected by Consort Xu, Wang Jian never actually removed Zhang. However, he considered replacing Wang Zongyan with Wang Zongjie, until Wang Zongjie's death in 918, which Wang Jian found suspicious but apparently did not investigate.
Later in 918, Wang Jian himself also fell seriously ill. Believing that his adoptive son, the general Wang Zongbi, was full of strategies and suitable for assisting the young emperor, he summoned Wang Zongbi back from the northern border with Qi and put him in charge of the imperial guards. He summoned the officials to the palace and, apparently still having reservations about Wang Zongyan, stated to them:
 ;templatestyles src="Template:Blockquote/styles.css" / ;The Crown Prince is kind but weak. I did not dare to disobey your petition, and therefore I created him crown prince. If he is indeed incapable of bearing this great responsibility, you may put him in a side palace, but please do not kill him. Instead, find another son of the Wang household to be the emperor and assist him. As far as Consort Xu's brothers are concerned, you may give them stipends and honors, but do not let them hold military commands, so that they can be preserved.
However, thereafter, Tang Wenyi blocked off access between Wang Jian and the officials, including Wang Zongbi, wanting to hold control of the ill emperor himself. However, Tang's partisan Pan Zaiying (潘在迎) betrayed his plans to the officials, and the officials forced their way into the palace and had Tang ejected from it (and later executed, as were his brother Tang Wenyi (唐文裔, note different character) and associate Wang Baohui (王保晦)). Shortly after, Wang Jian, after leaving an edict that put Wang Zongbi, the eunuch Song Guangsi, and other adoptive sons Wang Zongyao (王宗瑤), Wang Zongwan (王宗綰), and Wang Zongkui (王宗夔) in charge of assisting Wang Zongyan, died, and Wang Zongyan took the throne. He changed his name to Wang Yan.
Early reign.
After taking the throne, Wang Yan honored his mother Consort Xu the Greater as empress dowager and his aunt Consort Xu the Lesser as consort dowager (皇太妃, "Huang Taifei"). He created his wife Crown Princess Gao empress. As Zhang Ge was an associate of Tang Wenyi's, Zhang was exiled.
It was said that Wang Yan did not personally handle the affairs of state, instead entrusting all the important decisions to Wang Zongbi. Wang Zongbi, however, was corrupt and accepted many bribes, while Song Guangsi flattered both the emperor and him. This was seen as the beginning of the decline of the Former Shu state. It was also said that Wang Yan, Empress Dowager Xu, and Consort Dowager Xu often spent their times visiting the estates of officials and sceneries, drinking, and reciting poems, and the expenses for escorting them created a drain on the treasury. Further, Empress Dowager Xu and Consort Dowager Xu were also selling political offices, including offices as high as prefectural prefects, for money, further corrupting the political scene. Further, whenever Wang Yan's trusted officials and generals violated laws, he would not issue punishment, such that laws lost their powers.
In late 919, one of the major generals, Wang Yan's adoptive brother Wang Zonglang (王宗郎) the military governor of Xiongwu Circuit (雄武, headquartered in modern Ankang, Shaanxi) was declared to have committed crimes. Wang Yan stripped him of his titles and imperially bestowed name (changing his name back to his original name of Quan Shilang (全師郎)) and had another general, Sang Hongzhi (桑弘志) the military governor of Wuding Circuit (武定, headquartered in modern Hanzhong, Shaanxi) attack him. Sang quickly defeated and captured Quan, delivering him back to the capital Chengdu, but Wang Yan then released Quan. (Neither Quan's crimes nor the reason why Quan was then released was stated in historical records.)
In 920, there was an incident when Wang Yan went to offer sacrifices at the imperial temple dedicated to his father Wang Jian; he had the ladies from the palace, as well as the officials, offer food sacrifices and dedicate music that were not in accordance with Confucian regulations. When the sheriff Zhang Shiqiao (張士喬) urged him to follow proper regulations, Wang Yan became so angry that he almost put Zhang to death, only relenting when Empress Dowager Xu interceded. (Zhang was still exiled and committed suicide on the way to exile.)
Later in 920, during a campaign against Qi, Wang Yan decided to personally, with much fanfare, head to the frontline, despite contrary urging by official Duan Rong (段融). After reaching the frontline, he then returned to Chengdu, leaving the campaign to the generals. It was said that this tour much drained the resources of the prefectures that he went through. There was also an incident where a beautiful lady, the daughter of one He Kang (何康) of Lang Prefecture (閬州, in modern Nanchong, Sichuan) was ready to be married. Wang Yan seized her, giving silk to her would-be husband as compensation, but the would-be husband became so saddened that he died. Similarly, in 921, he seized the daughter of army officer Wang Chenggang (王承綱), and when Wang Chenggang asked for her back, he exiled Wang Chenggang. (Wang Chenggang's daughter, upon hearing this, committed suicide.)
Over the years, Wang Yan had never favored Empress Gao. In 921, while he was particularly favoring Consort Wei, he sent Empress Gao back to the house of her father Gao Zhiyan (高知言), effectively divorcing her. In shock, Gao stopped eating and died shortly after. (Consort Wei was actually a niece of Empress Dowager Xu's and originally named Xu, but as Wang Yan did not want it be known that he took his cousin as a consort, he falsely claimed that she was the granddaughter of the Tang chancellor Wei Zhaodu.) (Despite his favor for Consort Wei, she did not become empress; rather, he created another consort, Jin Feishan, empress.) He continued to much enjoy touring, and put up tents wherever he went to hide himself so that the people could not see him. Further, as he liked wearing a kind of large hat such that one could tell where he was by the hat, he ordered the men of the realm to all start wearing the hat.
Late reign.
Over the years, Wang Yan became accustomed to spend time in feasting, talking, and singing with Pan Zaiying, as well as the officials Han Zhao (韓昭) and Gu Zaixun (顧在珣). This allowed Song Guangsi to make the key decisions in Wang Yan's name. While there were officials who submitted petitions urging him to change his behavior, he did not do so (although he also did not, as Pan suggested, punish the officials). His cousin Wang Zongshou (王宗壽) the Prince of Jia also tried to get him to change his ways, to no avail.
In 923, Later Liang was destroyed by its archrival to the north, Later Tang. When Later Tang's Emperor Zhuangzong sent the news of Later Liang's destruction to Former Shu, the state was in much shock, but took no further action. When a comet (then considered a sign of impending disaster) subsequently appeared and the imperial astronomer indicated that a disaster was coming, Wang Yan established a field for offering prayer to the gods to try to stop the disaster. When the official Zhang Yun (張雲) argued that the more appropriate actions to take would be to make policy changes to appease the people, Wang Yan, in anger, exiled Zhang, and Zhang died on the way to exile.
Later Tang, while apparently in peace with Former Shu, was then planning an eventual invasion, which was also encouraged by the former Later Liang general Gao Jixing the military governor of Jingnan Circuit (荊南, headquartered in modern Jingzhou, Hubei), who had surrendered to Later Tang. In 924, Emperor Zhuangzong sent the emissary Li Yan (李嚴) to Former Shu, to observe the status of the Former Shu state. While at Former Shu, Li was making statements that glorified the Later Tang emperor that the Former Shu officials, including Wang Yan's adoptive brother Wang Zongchou (王宗儔), found offensive, and asked for Li to be arrested and executed, but Wang Yan did not agree. However, he commissioned Song Guangsi's brother Song Guangbao (宋光葆) (at Song Guangbao's request) as the military governor of Wude Circuit (武德, headquartered in modern Mianyang, Sichuan), to prepare the troops at Wude for a possible Later Tang evasion.
Li returned to Later Tang's capital Luoyang later in the year. Part of his mission was to exchange Later Tang horses for Former Shu jewels, but that part of the mission was unsuccessful, as Former