获取标头信息以防止缓存。
原型
wp_get_nocache_headers()
描述
几个不同的标题涵盖了不同浏览器处理缓存预防的不同方式
返回值
(array)
标题名称和字段值的关联数组。
源文件
路径:wp-includes/functions.php
<?php
...
function wp_get_nocache_headers() {
$headers = array(
'Expires' => 'Wed, 11 Jan 1984 05:00:00 GMT',
'Cache-Control' => 'no-cache, must-revalidate, max-age=0',
);
if ( function_exists('apply_filters') ) {
/**
* Filters the cache-controlling headers.
*
* @since 2.8.0
*
* @see wp_get_nocache_headers()
*
* @param array $headers {
* Header names and field values.
*
* @type string $Expires Expires header.
* @type string $Cache-Control Cache-Control header.
* }
*/
$headers = (array) apply_filters( 'nocache_headers', $headers );
}
$headers['Last-Modified'] = false;
return $headers;
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_get_nocache_headers/