wp_get_nocache_headers(): array

Gets the header information to prevent caching.


Description

The several different headers cover the different ways cache prevention is handled by different browsers


Top ↑

Return

array The associative array of header names and field values.


Top ↑

Source

File: wp-includes/functions.php. View all references

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.
		 */
		$headers = (array) apply_filters( 'nocache_headers', $headers );
	}
	$headers['Last-Modified'] = false;
	return $headers;
}

Top ↑

Hooks



Top ↑

Changelog

Changelog
Version Description
2.8.0 Introduced.

Top ↑

User Contributed Notes

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