Petrochemical wastewater containsp-nitrophenol, a highly toxic, bioaccumulative and persistent pollutant that can harm ecosystems and environmental sustainability. In this study, ZIF-8-PhIm was prepared forp-nitrophenol removal from petrochemical wastewater using solvent-assisted ligand exchange (SALE) with 2-phenylimidazole(2-PhIm). The ZIF-8-PhIm’s composition and structure were characterised using the XRD, SEM, FT-IR,1H NMR, XPS and BET methods. The adsorption effect of ZIF-8-PhIm onp-nitrophenol was investigated with the static adsorption method. Compared to the ZIF-8 materials, ZIF-8-PhIm exhibited stronger π-π interactions, produced a multistage pore structure with larger pore capacity and size, and had increased hydrophilicity and exposure of adsorption sites. Under optimised conditions (dose = 0.4 g/L, T = 298 K, C0= 400 mg/L), ZIF-8-PhIm achieved an adsorption amount of 828.29 mg/g, which had a greaterp-nitrophenol adsorption capacity compared to the ZIF-8 material. The Langmuir isotherm and pseudo-second-order kinetic models appropriately described thep-nitrophenol adsorption of ZIF-8-PhIm. Hydrogen bonding and π-π interactions dominated thep-nitrophenol adsorption of ZIF-8-PhIm. It also had relatively good regeneration properties.