元載
After Emperor Suzong died in 762 and was succeeded by his son Emperor Daizong, the chancellor Yuan Zai became a dominant figure at court. As Yuan had been recommended by Miao Jinqing, he treated Zhang Yanshang, as Miao's son-in-law, with kindness. When Emperor Daizong was forced to flee to Shan Prefecture (陝州, in modern Sanmenxia, Henan) in 763, at Yuan's recommendation, Emperor Daizong made Zhang an imperial attendant (給事中, "Jishizhong"). Soon thereafter, he became deputy chief imperial censor (御史中丞, "Yushi Zhongcheng") and "Zhongshu Sheren" (), a mid-level official at the legislative bureau of government (中書省, "Zhongshu Sheng").