Fix clear cache request handling to redirect to the current URL path with the query parameters _cache, _action, _wpnonce removed instead of wp_get_referer(). Previously, if the Referer request header was not sent, like if Referrer-Policy: no-referrer response header was set, this would cause the redirect to be cancelled and then script to be terminated. This lead to the response body being empty.
The clear URL can have query strings so $_SERVER['REQUEST_URI'] does not need to be filtered here as the path will be pulled from it in Cache_Enabler_Disk::get_cache_file_dir(). I think this was originally done due to the old, deprecated ce_action_cache_by_url_cleared action hook that used to be fired before the cache was cleared.
Fix clear cache request handling to redirect to the current URL path with the query parameters
_cache
,_action
,_wpnonce
removed instead ofwp_get_referer()
. Previously, if theReferer
request header was not sent, like ifReferrer-Policy: no-referrer
response header was set, this would cause the redirect to be cancelled and then script to be terminated. This lead to the response body being empty.The clear URL can have query strings so
$_SERVER['REQUEST_URI']
does not need to be filtered here as the path will be pulled from it inCache_Enabler_Disk::get_cache_file_dir()
. I think this was originally done due to the old, deprecatedce_action_cache_by_url_cleared
action hook that used to be fired before the cache was cleared.WordPress topic: https://wordpress.org/support/topic/blank-page-if-referrer-policy-directive-is-set/