Stockley took a senior moderatorship in modern literature at Trinity College, Dublin, where his classmates included Douglas Hyde, and graduated in 1883 with a BA in English and French. From 1896 to 1903 he was professor at the University of Ottawa and at the University of New Brunswick. In 1905, he was appointed professor of English at University College, Cork. He occupied the chair until his retirement in 1931. He was president of the Cork Literary and Scientific Society from 1913 to 1915 and President of the Cork Library Committee from 1913 to 1930. He was author of several books including English Visitors to Ireland from Raleigh to Newman, Newman, Education, and Ireland, Studies in Irish Biography and Introduction to the Dream of Gerontius.
Politics
Stockley was a member of Sinn Féin. He was an alderman of the Cork Corporation from 1920 to 1925. In 1920, an attempt was made on his life by police agents. In the 1921, he was elected a Sinn Féin member to the Second Dáil for the National University of Ireland constituency. He voted against the Anglo-Irish Treaty of 1921 and refused to accept the legitimacy of the Irish Free State. He retained his seat, as an Anti-Treaty Sinn Féin candidate, in the 1922 general election. Along with others, he maintained that the Irish Republic continued to exist and that the rump Second Dáil, composed of anti-Treaty TDs who refused to take their seats in the Free State parliament, was the only legitimate governmental authority in Ireland. He was defeated in the 1923 general election and subsequent 3 November 1923 by-election. In 1938, he was one of seven remaining abstentionist Second Dáil TDs who transferred the "authority" of what they believed was the Government of the Irish Republic to the IRA Army Council.
Family
William Stockley married Violet Osborne in 1892, daughter of Dublin artist William Osborne RHA and sister of Walter Osborne RHA. At her death in 1893 she left one daughter, Violet Annie Alice Stockley, who was brought up for some years by the Osborne family in Dublin. She later became a member of staff at Cheltenham Ladies' College and died unmarried in 1971. In 1908 Stockley married Marie Germaine Kolb, the daughter of Max Kolb, director of the Botanical Gardens in Munich, and Sophie Danvin, a French pianist. Marie Germaine Stockley died in Dublin in 1949 leaving one daughter, Sophia Stockley, who in 1933 married James Laurence Mallin, eldest son of the executed Michael Mallin. Stockley's brother was the Very Rev. Joseph John Gabbett Stockley, Canon of Lichfield Cathedral. Stockley's sister-in-law was the German writerAnnette Kolb, and a nephew, Dr Alfred Kolb, was a West German diplomat who helped establish the Federal Republic's first Irish legation in 1951. At his death in 1943 at the age of 84, Stockley resided at Arundel, Ballintemple, Cork. He is buried in St. Finbarr's Cemetery, Cork.