Set transient during ajax works to ensure it doesn't run on every page load. #2873