Recently published experimental observations of slender bacteria swimming in channel flow demonstrate that the bacteria become trapped in regions of high shear, leading to reduced concentrations near the channel’s centreline. However, the commonly used advection–diffusion equation, formulated in macroscopic space variables and originally derived for unbounded homogeneous shear flow, predicts that the concentration of bacteria is uniform across the channel in the absence of chemotactic bias. In this paper, we instead use a Smoluchowski equation to describe the probability distribution of the bacteria, in macroscopic (physical) and microscopic (orientation) space variables. We demonstrate that the Smoluchowski equation is able to predict the trapping phenomena and compare the full numerical solution of the Smoluchowski equation with experimental results when there is no chemotactic bias and also in the presence of a uniform cross-channel chemotactic gradient. Moreover, a simple analytic approximation for the equilibrium distribution provides an excellent approximate solution for slender bacteria, suggesting that the dominant effect on equilibrium behaviour is flow-induced modification of the bacteria’s swimming direction. A continuum framework is thus provided to explain how the equilibrium distribution of slender chemotactic bacteria is altered in the presence of spatially varying shear flow. In particular, we demonstrate that while advection is an appropriate description of transport due to the mean swimming velocity, the random reorientation mechanism of the bacteria cannot be simply modelled as diffusion in physical space.