How long can a photon sometimes take to travel from a star's core to its surface?

Answer

Hundreds of thousands of years.

Once created in the core, a photon can take an unexpectedly long time, sometimes hundreds of thousands of years, bouncing through the dense inner layers before finally escaping the star's photosphere.

How long can a photon sometimes take to travel from a star's core to its surface?
lightastronomystar