Early in Wu Zetian's
Shengli era (697–700) (when she was ruling as Empress Regnant of a new Zhou dynasty, interrupting the
Tang dynasty), Zhang Jianzhi was promoted to be
Fengge Sheren (), a mid-level official at the legislative bureau of government (鳳閣,
Fengge). Around that time, he had a debate with the imperial scholar Wang Yuangan () over whether the traditional three-year mourning period for a parent's death should be three full years (as Wang advocated) or 25 months—i.e., two full calendar years, extending into the first month of the next year (as Zhang advocated). The people at the time were said to be largely approving Zhang's interpretation. In 698, Wu Zetian was set to enter into a
marriage treaty with
Ashina Mochuo, the khan of
Eastern Tujue, where her grandnephew Wu Yanxiu () the Prince of Huaiyang would marry a daughter of Ashina Mochuo. Zhang opposed, stating, "In ancient times, no Chinese imperial prince had ever married a barbarian woman as his wife." This opposition drew displeasure from Wu Zetian, as she wanted peace with Eastern Tujue, and she demoted Zhang to be the prefect of He Prefecture (合州, modern northern
Chongqing). (However, the marriage treaty would be doomed, as Ashina Mochuo, not actually having any intent to give a daughter to Wu Yanxiu or to make peace with Wu Zetian, used the excuse that he had intended to marry his daughter to a prince of the Tang imperial Li clan to instead detain Wu Yanxiu and launch a major attack on Zhou.) Later that year, Zhang was serving as the prefect of Shu Prefecture (蜀州, in modern Chengdu), when he made the suggestion that Shu Prefecture, which was required to send 500 conscript soldiers to take up garrison at Yao Prefecture (姚州, roughly modern
Chuxiong Yi Autonomous Prefecture,
Yunnan), no longer be required to do so, as the road was treacherous and the conditions were so severe that many would die—and further that no garrison be put up at Yao Prefecture at all, treating it as
vassal territory rather than part of Zhou proper. Wu Zetian did not accept his suggestion. At some time prior to 700, Zhang was serving as the secretary general of Jing Prefecture (荊州, roughly modern
Jingzhou,
Hubei), when, on one occasion, Wu Zetian was having a conversation with the senior
chancellor Di Renjie, asking Di's recommendation for someone with extraordinary talent, to serve as chancellor or general. Di responded, "As far as literary talent is concerned, Your Imperial Majesty already have them in
Su Weidao and
Li Jiao [Di's fellow chancellors], but if you truly want extraordinary talent, I know Zhang Jianzhi, the secretary general of Jing Prefecture. Even though he is old, he is capable of being chancellor." In response, Wu Zetian promoted Zhang to be the military advisor to the prefect of the capital prefecture Luo Prefecture (洛州, roughly modern
Luoyang,
Henan), sending Yang Yuanyan () to replace him. (When Yang reached Jing Prefecture, Zhang and Yang rowed a boat on the
Yangtze River together, and they secretly discussed Wu Zetian's overthrow of the Tang dynasty. During the conversation, Yang expressed sentiment that he wanted to see Tang's restoration—a sentiment that Zhang kept in his mind for later.) A few days after Zhang's promotion, Wu Zetian was again asking Di for a recommendation, and Di responded, "I had just recommended Zhang Jianzhi, and Your Imperial Majesty has not yet promoted him." She responded, "I already did." Di responded, "I recommended a chancellor, not a military advisor." Wu Zetian then, while not promoting Zhang to be chancellor at that time, promoted him to be the deputy minister of justice (秋官侍郎,
Qiuguan Shilang). In 704, as the chancellor
Yao Yuanzhi was set to briefly leave Luoyang to serve as the commander of the forces in the
Lingwu region, Wu Zetian also asked him to recommend a talented official. Yao responded, "Zhang Jianzhi is deep-thinking and capable of ruling on great things. He is already old. Please promote him quickly." Wu Zetian therefore gave Zhang the designation
Tong Fengge Luantai Pingzhangshi (), making him a chancellor
de facto at the age of 79. In spring 705, with Wu Zetian being ill, Zhang entered into a plot with a number of officials and generals, including
Cui Xuanwei,
Huan Yanfan,
Jing Hui, and
Yuan Shuji, to kill Wu Zetian's lovers
Zhang Yizhi and
Zhang Changzong, who had become powerful much to the distaste of the chancellors. Zhang reminded Yang of his prior desire to restore Tang, and put him, Huan, Jing, and a general who agreed to the plot, Li Dan (), in charge of some of the corps of the imperial guards. He further persuaded the ethnically
Mohe general
Li Duozuo to join the plot as well, persuading Li Duozuo, who felt indebted to Emperor Gaozong for having promoted him, that Zhang Yizhi and Zhang Changzong were endangering the positions of Emperor Gaozong's sons with Wu Zetian,
Li Xian the
Crown Prince and
Li Dan the Prince of Xiang (note different character than the general). He also received agreement from Yao. With agreement from Li Xian as well, the coup leaders acted on February 20, killing Zhang Yizhi and Zhang Changzong, and then surrounding Wu Zetian. She, in fear, asked, "Who is disturbing me?" Zhang Jianzhi responded, in a formalistic manner: Wu Zetian subsequently tried to have Li Xian returned to the palace of the Crown Prince, but the coup leaders ignored her. While the coup leaders allowed Wu Zetian to retain the title of "emperor," they had her put under house arrest at the secondary palace Shangyang Palace () and forced her to yield the throne to Li Xian, who was formerly emperor, and he was restored to the throne (as Emperor Zhongzong). == During Emperor Zhongzong's second reign ==