Highlights Embedded material promoted humic acid formation and reduced the toxicity of metals. The bacterial community structure and function distribution changed. Biochar addition promoted humic acid formation through stable community. The added biochar did not adsorb heavy metals, but promote passivation by humic acid.