It is not known when Wang Shaoyi was born. His family had been, prior to his generation, in control of Chengde Circuit for two generations, after his grandfather Wang Tingcou seized control of the circuit in 821 without imperial approval and eventually forced the imperial government to acquiesce; his father Wang Yuankui later succeeded Wang Tingcou and took a more conciliatory stance with the imperial government. Wang Shaoyi had at least one older brother, Wang Shaoding.[1]
When Wang Yuankui died in 855, the soldiers supported Wang Shaoding to succeed him. Then-reigning Emperor Xuānzong initially made Wang Shaoding acting military governor, and, later in the year, full military governor. However, Wang Shaoding was inappropriate in his behavior, favoring drinking, and particularly liking to sling bullets at people from towers for fun. The soldiers became so displeased with him that they considered overthrowing him, but before they could do so, he fell ill and died in 857. The soldiers supported Wang Shaoyi, who was then deputy military governor, to succeed him. Emperor Xuānzong approved and made Wang Shaoyi acting military governor, and then military governor.[2]