The subject of William Holman Hunt's The Hireling Shepherd was actually taken from William Shakespeare's King Lear. In the play, the character Edgar sings a song about a shepherd neglecting its flock, and Hunt used the song as an inspiration for his work.
King Lear Act III, Scene VI.41
Edgar: "Sleepest or wakest thou, jolly shepherd?
Thy sheep be in the corn;
And for one blast of thy minikin mouth,
Thy sheep shall take no harm."
If the song is rather reminiscent of "Little Bo-Peep," it's no accident. King Lear is actually referred to as "Bo-Peep" by the court jester earlier in the play (I.iv)
Fool: Then they for sudden joy did weep,
And I for sorrow sung,
That such a king should play bo-peep,
And go the fools among.
In King Lear, the shepherd analogy is used to show that the King has been distracted from his calling as "shepherd" to his "flock."
William Holman Hunt actually wrote a letter on this subject that I found on Shakespeare Illustrated--a great website that connects 19th century paintings to their roots in Shakespeare's work.
Shakespeare's song represents a Shepherd who is neglecting his real duty of guarding the sheep: instead of using his voice in truthfully performing his duty, he is using his "minikin mouth" in some idle way. He was a type thus of other muddle headed pastors who instead of performing their services to their flock--which is in constant peril--discuss vain questions of no value to any human soul. My fool has found a death's head moth, and this fills his little mind with forebodings of evil and he takes it to an equally sage counsellor for her opinion. She scorns his anxiety from ignorance rather than profundity, but only the more distracts his faithfulness: while she feeds her lamb with sour apples his sheep have burst bounds and got into the corn. It is not merely that the wheat will be spoilt, but in eating it the sheep are doomed to destruction from becoming what farmers call "blown." (Quoted by Landow, 39).
I really enjoy the humour in this painting. At first glance, the viewer is presented with an idyllic setting--rolling hills dotted with sheep, a happy young couple, a winding stream and a field of golden wheat.
But on closer inspection, it turns out that a number of the sheep are lying on the grass, unable to get up! You can see one of the sheep on the left of the canvas is even helplessly flailing his legs! One of the sheep has wondered across the stream and is eating barleycorn (note: in King Lear, Edgar refers to the sheep being in the corn--in Shakespeare's day, corn meant barleycorn--there was no maize until after the European discovery of the Americas), which probably isn't good for him, and refers directly to the song from King Lear. The lamb resting in the girls lap is eating green apples, which are probably making him sick as well. The girl, who at first blush seemed to be relaxing in the grass happily with the shepherd boy, actually looks a little uneasy. The shepherd boy is showing her something--a death's head moth! He's also totally neglecting his work and seems oblivious to what is happening to his flock.
The painting was first exhibited in 1851.