ABSTRACT Observations of the Atacama Large Millimeter Array (ALMA) revealed recently polarized radiation of several protoplanetary discs in the (sub)millimetre wavelength range. Besides self-scattering of large particles, thermal emission by elongated grains is a potential source for the detected polarization signal. We calculate the wavelength dependent absorption and intrinsic polarization of spheroidally shaped, micrometre, and submillimetre sized dust grains using the discrete dipole approximation. In particular, we analyse the impact of dust grain porosity that appears to be present in discs when small grains coagulate to form larger aggregates. For the first time, our results show that (a) the intrinsic polarization decreases for increasing grain porosity and (b) the polarization orientation flips by 90 deg for certain ratios of wavelength to grain size. We present a new method to constrain grain porosity and the grain size in protoplanetary discs using multiwavelength polarization observations in the far-infrared to millimetre wavelengths. Finally, we find that moderate grain porosities ($\mathcal {P}\lesssim 0.7$) potentially explain the observed polarization fraction in the system HD 142527 while highly porous grains ($\mathcal {P}\gt 0.7$) fail unless the grain’s axis ratio is extraordinarily large.