Probably because the author followed this blog: http://www.wildml.com/2015/12/implementing-a-cnn-for-text-cl...
That blog used a 2d cnn because tensorflow didn't have a 1d version at the time of writing, so he just created a dummy 2nd dimension of length 1 and called it a day.