Emperor Dezong died in 805, and was succeeded by his severely ill son Emperor Shunzong who, in turn, after reigning only a few months, passed the throne to his own son Emperor Xianzong.[5] As Emperor Xianzong was named Li Chun, Wei Chun no longer used his original name and used his courtesy name of Guanzhi instead, to observe naming taboo.[6] Shortly after Emperor Xianzong became emperor, Wei Guanzhi was made an imperial censor with the title of Jiancha Yushi (監察御史). He submitted a petition asking that the position be given to his brother Wei Xun instead. As a result, he was made You Bujue (右補闕), a consultant at the legislative bureau of government (中書省, Zhongshu Sheng), while Wei Xun was made Jiancha Yushi. In 806, when Du Congyu (杜從郁), the son of the chancellor Du You, was set to be made Zuo Bujue (左補闕), a consultant at the examination bureau, Wei Guanzhi and Cui Qun suggested that this was improper. Initially, Du Congyu's title was reduced to Zuo Shiyi (左拾遺), a lower rank, but still a consultant at the examination bureau, Wei and Cui further clarified their rationale — that the consultants were there to suggest to the emperor corrections to make when the chancellors' governance were not proper, and they believed it improper for Du Congyu to be effectively casting judgment on his father's governance. Du Congyu thus was instead made the secretary general of the archival bureau.[3][7]
At a later point, he and Zhang Hongjing were in charge of a special imperial examination on strategies, and it was said that of the 18 people they selected as the high scores, most were later well known for their writing. Wei later served as Lǐbu Yuanwailang (禮部員外郎), a low-level official at the ministry of rites (禮部, Lǐbu). While he was serving there, there was an occasion when the deputy director of palace supplies, Jin Zhongyi (金忠義), who was from Silla and who had apparently previously been a merchant, requested that his two sons be made officials. Wei refused, pointing out that sons of merchants and laborers, pursuant to regulation, would not be made officials. Jin lobbied a number of powerful officials, but Wei insisted and directly reported this matter to the emperor, and Jin's sons were not given offices. Wei was thereafter made Lìbu Yuanwailang (吏部員外郎), a low-level official at the ministry of civil service affairs (吏部, Lìbu, note different tone than the ministry of rites).[3]
In 808, when Emperor Xianzong held a special imperial examination for the examinees to give honest criticism of government, Wei and Yang Yuling (楊於陵) were in charge of the examination, and Wei selected three examinees who gave blunt criticism — Niu Sengru, Huangfu Shi (皇甫湜), and Li Zongmin — for top marks. However, the chancellor Li Jifu were stung by the criticism that they gave and viewed these as personal attacks against him. Li Jifu tearfully complained to Emperor Xianzong that the reviewers of the scores that Wei and Yang gave — the imperial scholars Pei Ji and Wang Ya — had conflicts of interest, as Huangfu was Wang's nephew. As a result of Li Jifu's accusations, Pei, Wang, Yang, and Wei were all demoted, with Wei initially demoted to be the prefect of Guo Prefecture (果州, in modern Nanchong, Sichuan), and then further moved to be the prefect of Ba Prefecture (巴州, in modern Bazhong, Sichuan).[8] However, Wei was soon summoned back to Chang'an to serve as Duguan Langzhong (都官郎中), a supervisorial official at the ministry of justice (刑部, Xingbu) and put in charge of drafting imperial edicts. The next year, he was made Zhongshu Sheren (中書舍人), a mid-level official at the legislative bureau.[3] In 811, he participated in a major revision of official salaries that Li Jifu advocated, along with Xu Mengrong (許孟容) and Li Jiang.[9] Wei was thereafter made the deputy minister of rites (禮部侍郎, Lǐbu Shilang). He served as deputy minister of rites for two years, and the examinees that he selected as top scorers were the ones that he felt to have valued substance over form, and it was said because of his policy, those who tried influence examination results decreased. He was later made Shangshu You Cheng (尚書右丞), one of the secretaries general of the executive bureau (尚書省, Shangshu Sheng).[3]
In 814, Wei Guanzhi was given the title of Tong Zhongshu Menxia Pingzhangshi (同中書門下平章事), making a chancellor de facto. In 815, while the imperial forces were engaged in a campaign against the warlord Wu Yuanji, who controlled Zhangyi Circuit (彰義, headquartered in modern Zhumadian, Henan), Wei's fellow chancellor Wu Yuanheng, in charge of the campaign, was assassinated. It was believed at the time that Wu Yuanheng's assassins were sent by Wu Yuanji's ally Wang Chengzong the military governor of Chengde Circuit (成德, headquartered in modern Shijiazhuang, Hebei). In 816, Emperor Xianzong declared a campaign against Wang as well, over Wei's objections that waging two campaigns simultaneously could bring another confluence of revolts like the revolt of Zhu Ci that caused Emperor Dezong to have to flee from the capital, but Emperor Xianzong did not listen to him.[10] Further, at this time, Emperor Xianzong favored the speaking abilities of a low-level consultant, Zhang Su (張宿), and sent Zhang on a diplomatic mission to meet with another warlord, Li Shidao the military governor of Pinglu Circuit (平盧, headquartered in modern Tai'an, Shandong), and when the chancellor Pei Du sought a more honorable uniform for Zhang than Zhang's rank was entitled to, Wei rejected it, believing that Zhang was wicked, thus drawing Zhang's resentment.[3][7] It was further said that Wei was arrogant and did not associate with people that he believed to be of low birth. He was also drawing anger from Emperor Xianzong for his opposition to Emperor Xianzong's campaigns. With Zhang accusing Wei of partisanship, in summer 816, Wei was removed from his chancellor position and made the deputy minister of civil service affairs (吏部侍郎, Lìbu Shilang). In fall 816, he was further demoted out of the capital to serve as the governor (觀察使, Guanchashi) of Hunan Circuit (湖南, headquartered in modern Changsha, Hunan).[10] His brother Wei Xun was also demoted,[3] while several other officials — Wei Yi (韋顗), Li Zhengci (李正辭), Xue Gonggan (薛公幹), Li Xuan (李宣), Wei Chuhou, and Cui Shao (崔韶) — were accused of being of Wei Guanzhi's associates and demoted out of the capital to serve as prefectural prefects.[7]
After Wei Guanzhi began his service as the governor of Hunan, there was an occasion, due to the imperial treasury's depletions from the campaigns, Emperor Xianzong commissioned the deputy director of salt and iron monopolies, Cheng Yi, to tour the circuits and collect tax revenues from the circuits. Wherever Cheng went, he persuaded the governors to impose special taxes and submit them, but Wei was unwilling to do so. Instead, Wei only submitted the reserves that the circuit had. He was thereafter given the title of the head of the household of the crown prince Li Heng, but ordered to keep his office at the eastern capital Luoyang.[3]