Ultrafast x-ray science is an exciting frontier that promises the visualization of electronic, atomic and molecular dynamics on atomic time and length scales. A largely unexplored area of ultrafast x-ray science is the use of light to control how x-rays interact with matter. In order to extend control concepts established for long wavelength probes to the x-ray regime, the optical control field must drive a coherent electronic response on a timescale comparable to femtosecond core-hole lifetimes. An intense field is required to achieve this rapid response. Here an intense optical control pulse is observed to efficiently modulate photoelectric absorption for x-rays and to create an ultrafast transparency window. We demonstrate an application of x-ray transparency relevant to ultrafast x-ray sources: an all-photonic temporal cross-correlation measurement of a femtosecond x-ray pulse. The ability to control x-ray/matter interactions with light will create new opportunities at current and next-generation x-ray light sources.