Emperor Zhaozong of Tang
Liu Yan was born in 889, during the reign of Emperor Zhaozong of Tang. His father Liu Zhiqian (also known as Liu Qian) was then the prefect of Feng Prefecture (封州, in modern Zhaoqing, Guangdong) and was married to a Lady Wei, the niece of Wei Zhou (韋宙), a prior military governor ("Jiedushi") of Lingnan East Circuit (嶺南東道, headquartered in modern Guangzhou, Guangdong), which Feng Prefecture belonged to. However, he also secretly had a concubine outside the home, a Lady Duan, and it was to Lady Duan that Liu Yan was born. When Lady Wei found out, she killed Lady Duan, but could not bear to kill the infant Liu Yan, and she took him back home to be raised as her own, as a younger brother to her own sons Liu Yin and Liu Tai (劉台).