JCam, There are various records re the " old West Riding" held in Wakefield. Might be worthwhile using that as a starting point. Re Magistrates Courts held at Castleford, there were 2 different courts there, one relating to Castleford itself, and the 2nd was Castleford West Riding Court, which covered the areas outside the town, such as Allerton Bywater, Ledston, Methley, etc., etc. That was even though Castleford itself and the outer areas were policed by the West Riding Constabulary.
Best of luck.