Wei Zhigu was born in 647, during the reign of . His family was from Shen Prefecture , but nothing else is known about his ancestors. In his youth, he was known for honesty and abilities, and he passed the imperial examinations. He was eventually made ''Zhuzuo Lang'' , a low level official at the archival bureau , and was involved in editing imperial histories.
During Wu Zetian's reign
During the ''Chang'an'' era of Emperor Taizong's daughter-in-law Wu Zetian , Wei Zhigu successively served as ''Fengge Sheren'' -- a mid-level official at the legislative bureau of government -- and deputy minister of military supplies . He was also made the military advisor to Wu Zetian's son the Prince of Xiang.
During Emperor Zhongzong's second reign
In 705, Wu Zetian was overthrown in a coup, and Li Dan's older brother the Crown Prince, a former emperor, returned to the throne . Soon thereafter, Wei Zhigu was made deputy minister of civil service affairs and was again responsible for editing imperial histories. He also soon received the honorific title ''Yinqing Guanglu Daifu'' . In 706, he left public service to observe a mourning period for his mother, but before the mourning period was over, he was recalled to serve as the prefect of Jin Prefecture .
During Emperor Ruizong's second reign
In 710, Emperor Zhongzong died, and after power struggle at court, Li Dan, himself a former emperor, took the throne again . On account of Wei Zhigu's previously having served him, he recalled Wei to the capital Chang'an to serve as ''Huangmen Shilang'' , the deputy head of the examination bureau , and had him resume editing the imperial histories. In 711, he was made ''You Sanqi Changshi'' , a senior advisor at the legislative bureau . At that time, Emperor Ruizong was expending much funds and efforts to build Taoist temples for his daughters Princesses Jinxian and Yuzhen, who had become Taoist nuns. Wei wrote two earnestly-worded petitions asking that the projects be stopped. Emperor Ruizong did not accept them, but thanked him for his honesty and gave him the designation ''Tong Zhongshu Menxia Pingzhangshi'' , making him a ''de facto''. Also at that time, he was made ''Zuo Sanqi Changshi'' , moving him from the legislative bureau to the examination bureau. He was also made a member of the staff of Emperor Ruizong's crown prince . Soon thereafter, he was made the minister of census .
During Emperor Xuanzong's reign
In 712, Emperor Ruizong passed the throne to Li Longji, who took the throne as Emperor Xuanzong, but Emperor Ruizong retained imperial powers as ''Taishang Huang'' . Soon thereafter, Wei Zhigu was made ''Shizhong'' , the head of the examination bureau and a post considered one for a chancellor. In winter 712, when he accompanied Emperor Xuanzong on a hunt, he wrote a poem that suggested to Emperor Xuanzong that he should not hunt frequently, due to the expense and dangers involved. Emperor Xuanzong wrote an edict thanking him and awarding him with silk.
In 713, Wei was created the Duke of Liang. At that time, the power struggles between Emperor Xuanzong and his aunt Princess Taiping were coming to a head. It was said that Princess Taiping, Dou Huaizhen, Cen Xi, Xiao Zhizhong, Cui Shi; along with other officials Xue Ji, Li Jin the Prince of Xinxing , Li You , Jia Yingfu , Tang Jun ; the generals Chang Yuankai , Li Ci , and Li Qin ; and the monk Huifan , were plotting to overthrow Emperor Xuanzong. It was further said that they discussed, with the lady in waiting Lady Yuan to poison an aphrodisiac that Emperor Xuanzong took regularly known as ''chijian'' ). When this alleged plot was reported to Emperor Xuanzong by Wei, Emperor Xuanzong, who had already received advice from Wang Ju , Zhang Shuo, and Cui Riyong to act first, did so. He convened a meeting with his brothers Li Fan the Prince of Qi, Li Ye the Prince of Xue, Guo, along with a number of his associates — the general Wang Maozhong , the officials Jiang Jiao and Li Lingwen , his brother-in-law Wang Shouyi , the eunuch Gao Lishi, and the military officer Li Shoude — and decided to act first. On July 29, Emperor Xuanzong had Wang Maozhong take 300 soldiers to the imperial guard camp to behead Chang and Li Ci. Then, Jia, Li You, Xiao, and Cen were arrested and executed as well. Dou and Princess Taiping committed suicide. When Emperor Ruizong heard about the incident, he ascended the tower at Chengtian Gate to try to ascertain what was happening, and it was Guo who informed him what happened. Emperor Ruizong subsequently yieldedpowers to Emperor Xuanzong and no longer actively participated in policy decisions thereafter. For Wei's contributions, Emperor Xuanzong enlarged his fief and awarded him with silk. In winter 713, Wei went to the eastern capital Luoyang to carry out a selection process for officials there, and was considered to have done an exceptional job, drawing praises from Emperor Xuanzong. As Emperor Xuanzong carried out major revisions of names of official titles and offices in 713, Wei's title as the head of the examination bureau was changed to ''Huangmen Jian'' , as the bureau itself was renamed ''Huangmen Sheng'' .
That trip to Luoyang, however, would indirectly lead to Wei's fall. By this point, Yao Chong, who had previously served as Wei's superior during Wu Zetian's reign, was again chancellor and was well-trusted by Emperor Xuanzong. While Wei was in Luoyang, two of Yao's sons, then serving as officials at Luoyang, were accepting bribes and using their father's connections with Wei to make requests of Wei, displeasing Wei. Further, Yao aggravated Wei by having Song Jing review the decisions that Wei made while at Luoyang. After Wei returned to Chang'an, he reported what had happened with Yao's sons in Luoyang. Emperor Xuanzong summoned Yao, initially ready to question him, but Yao realized what had happened and preemptively reported on his sons, implying that his sons had only dared to make requests of Wei because of Yao's own good treatment of Wei when Wei was a subordinate. Emperor Xuanzong, now believing that Wei was ungrateful, wanted to remove Wei, but ultimately only demoted Wei to be the minister of public works , no longer a chancellor. Wei died in 715.