Wall-bounded turbulent flows are widely observed in natural and engineering systems, such as air flows near the Earth's surface, water flows in rivers, and flows around a car or a plane. The universal logarithmic velocity profile in wall-bounded turbulent flows proposed by von Kármán in 1930 is one of the few exact physical descriptions of turbulence. However, the mean velocity and temperature profiles cannot be adequately described by this universal log law when buoyancy effects are present. Monin-Obukhov similarity theory (MOST), proposed in 1954, has been the cornerstone theory to account for these buoyancy effects and to describe the atmospheric boundary layer. MOST has been used in almost all global weather, climate and hydrological models to describe the dependence of the mean velocity, temperature and scalar profiles on buoyancy. According to MOST, the logarithmic temperature profile breaks down as buoyancy effects become important. In contrast, here we show that this long-standing MOST theory does not apply for temperature. We propose a new theory for the logarithmic profile of near-wall temperature, which corrects MOST pitfalls and is supported by both high-resolution direct numerical simulations and field observations of the convective atmospheric boundary layer. Buoyancy effects do not modify the logarithmic nature but instead modulate the slope of the temperature profile compared to the universal von Kármán slope. The new formulation has widespread applications such as in climate models, where the proposed new temperature log law should lead to more realistic continental surface temperature, which are strongly impacted by buoyancy.