This is not true because plants need to sequester nitrogen from the soil to build amino acids.
While photosynthesis provides plants with glucose (which contains carbon, hydrogen, and oxygen), plants also require nitrogen and other minerals for synthesizing amino acids and nucleic acids, which are crucial for building proteins and DNA/RNA. Therefore, the statement that plants create everything they need solely through photosynthesis is inaccurate.