Quantifying the effects of pore‐filling materials on elastic properties of porous rocks is of considerable interest in geophysical practice. For rocks saturated with fluids, the Gassmann equation is proved effective in estimating the exact change in seismic velocity or rock moduli upon the changes in properties of pore infill. For solid substance or viscoelastic materials, however, the Gassmann theory is not applicable as the rigidity of the pore fill (either elastic or viscoelastic) prevents pressure communication in the pore space, which is a key assumption of the Gassmann equation. In this paper, we explored the elastic properties of a sandstone sample saturated with fluid and solid substance under different confining pressures. This sandstone sample is saturated with octadecane, which is a hydrocarbon with a melting point of 28°C, making it convenient to use in the lab in both solid and fluid forms. Ultrasonically measured velocities of the dry rock exhibit strong pressure dependency, which is largely reduced for the filling of solid octadecane. Predictions by the Gassmann theory for the elastic moduli of the sandstone saturated with liquid octadecane are consistent with ultrasonic measurements, but underestimate the elastic moduli of the sandstone saturated with solid octadecane. Our analysis shows that the difference between the elastic moduli of the dry and solid‐octadecane‐saturated sandstone is controlled by the squirt flow between stiff, compliant, and the so‐called intermediate pores (with an aspect ratio larger than that of compliant pore but much less than that of stiff pores). Therefore, we developed a triple porosity model to quantify the combined squirt flow effects of compliant and intermediate pores saturated with solid or viscoelastic infill. Full saturation of remaining stiff pores with solid or viscoelastic materials is then considered by the lower embedded bound theory. The proposed model gave a reasonable fit to the ultrasonic measurements of the elastic moduli of the sandstone saturated with liquid or solid octadecane. Comparison of the predictions by the new model to other solid substitution schemes implied that accounting for the combined effects of compliant and intermediate pores is necessary to explain the solid squirt effects.