function wp_get_nocache_headers() {}

Gets the header information to prevent caching.
The several different headers cover the different ways cache prevention is handled by different browsers

Return values

returns:The associative array of header names and field values.

Defined filters

  • nocache_headers
    apply_filters('nocache_headers', $headers)

Source code

function wp_get_nocache_headers() {

	$headers = array(

		'Expires' => 'Wed, 11 Jan 1984 05:00:00 GMT',

		'Last-Modified' => gmdate( 'D, d M Y H:i:s' ) . ' GMT',

		'Cache-Control' => 'no-cache, must-revalidate, max-age=0',

		'Pragma' => 'no-cache',


	if ( function_exists('apply_filters') ) {

		$headers = (array) apply_filters('nocache_headers', $headers);


	return $headers;



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: