The hierarchically porous graphitic carbon monoliths containing nickel nanoparticles (HPGCM-Ni) were fabricated via multi-component co-assembly in polyurethane (PU) foam scaffold associated with a direct carbonization process from triblock copolymer F127, diblock copolymer PDMS-PEO, phenolic resol, and nickel nitrate and subsequent silicates removal with NaOH solution. The decomposable PU foam scaffold played important role in the process of multi-component co-assembly and macrostructure formation. The nickel salts were reduced to metallic Ni nanoparticles during the carbonization process. The obtained HPGCM-Ni materials exhibited macropores of 100–450 μm, mesopore size of 7.2 nm, BET surface area of 725 m2 g−1, pore volume of 0.74 cm3 g−1, and saturation magnetization of 2.3 emu g−1. Using methyl orange as model dye pollutant in water, HPGCM-Ni samples showed good adsorption capacity of 440 mg g−1, exhibiting excellent adsorption characteristics desirable for the application in adsorption of dyes and separation under an external magnetic field. © 2014 Wiley Periodicals, Inc. J. Appl. Polym. Sci. 2015, 132, 41322.