I'm grateful to a bloke on the HäT Forum for jogging my memory about this. I remember reading something in, perhaps, one of Ian Hogg's books about Maoris using earthworks during the Maori War of the 1860s.
Trench warfare in the Great War sense is usually said to have its origins in the American Civil War and developed through the Prusso-Danish, Russo-Turkish, Russo-Japanese and Balkan Wars, but these seem to be even earlier than the ACW.
Further googling reveals that these earthworks were remarkably similar to those of the Western Front, pallisades serving roughly the same purpose as barbed wire, and traverses and dugouts included.
"Sometimes things that are not true are included in Wikipedia. While at first glance that may appear like a very great problem for Wikipedia, in reality is it not. In fact, it's a good thing." - Wikipedia.