From 183b4b621297b8547ca09b89e1d4d94be7331d8b Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Sat, 22 Jun 2019 11:12:58 +0000 Subject: [PATCH] Cron API: Prevent caching of WP Cron requests. Add `Cache-Control` and `Expires` HTTP headers to prevent caching of requests to WP Cron on systems supporting fastcgi_finish_request(). The fastcgi_finish_request() call prevents the setting of further HTTP headers by caching plugins subsequently loaded. Props kingkero. Fixes 47396. git-svn-id: https://develop.svn.wordpress.org/trunk@45560 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-cron.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wp-cron.php b/src/wp-cron.php index 1d848c3b35..7853e79e96 100644 --- a/src/wp-cron.php +++ b/src/wp-cron.php @@ -20,6 +20,8 @@ ignore_user_abort( true ); /* Don't make the request block till we finish, if possible. */ if ( function_exists( 'fastcgi_finish_request' ) && version_compare( phpversion(), '7.0.16', '>=' ) ) { + header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); + header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); fastcgi_finish_request(); }