The rapidly evolving dust and gas extinction observed towards WD 1145+017 has opened a real-time window onto the mechanisms for destruction-accretion of planetary bodies onto white dwarf stars, and has served to underline the importance of considering the dynamics of dust particles around such objects. Here it is argued that the interaction between (charged) dust grains and the stellar magnetic field is an important ingredient in understanding the physical distribution of infrared emitting particles in the vicinity of such white dwarfs. These ideas are used to suggest a possible model for WD 1145+017 in which the unusual transit shapes are caused by opaque clouds of dust trapped in the stellar magnetosphere. The model can account for the observed transit periodicities if the stellar rotation is near 4.5 h, as the clouds of trapped dust are then located near or within the co-rotation radius. The model requires the surface magnetic field to be at least around some tens of kG. In contrast to the eccentric orbits expected for large planetesimals undergoing tidal disintegration, the orbits of magnetospherically-trapped dust clouds are essentially circular, consistent with the observations.