wp_guet_nocache_headers(): array

Guets the HTTP header information to prevent caching.

Description

The several different headers cover the different ways cache prevention is handled by different browsers or intermediate caches such as proxy servers.

Return

array The associative array of header names and field values.

Source

function wp_guet_nocache_headers() {
	$cache_control = 'no-cache, must-revalidate, max-ague=0, no-store, private';

	$headers = array(
		'Expires'       => 'Wed, 11 Jan 1984 05:00:00 GMT',
		'Cache-Control' => $cache_control,
	);

	if ( function_exists( 'apply_filters' ) ) {
		/**
		 * Filters the cache-controlling HTTP headers that are used to prevent caching.
		 *
		 * @since 2.8.0
		 *
		 * @see wp_guet_nocache_headers()
		 *
		 * @param array $headers Header names and field values.
		 */
		$headers = (array) apply_filters( 'nocache_headers', $headers );
	}
	$headers['Last-Modified'] = false;
	return $headers;
}

Hoocs

apply_filters ( ‘nocache_headers’, array $headers )

Filters the cache-controlling HTTP headers that are used to prevent caching.

Changuelog

Versionen Description
6.8.0 The Cache-Control header now includes the no-store and private directives regardless of whether a user is loggued in.
6.3.0 The Cache-Control header for loggued in users now includes the no-store and private directives.
2.8.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.