Filter hook 'nocache_headers'

in WP Core File wp-includes/functions.php at line 1520

View Source

nocache_headers

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

Hook Information

File Location wp-includes/functions.php View on GitHub
Hook Type Filter
Line Number 1520

Hook Parameters

Type Name Description
array $headers Header names and field values.

Usage Examples

Basic Usage
<?php
// Hook into nocache_headers
add_filter('nocache_headers', 'my_custom_filter', 10, 1);

function my_custom_filter($headers) {
    // Your custom filtering logic here
    return $headers;
}

Source Code Context

wp-includes/functions.php:1520 - How this hook is used in WordPress core
<?php
1515  		 *
1516  		 * @see wp_get_nocache_headers()
1517  		 *
1518  		 * @param array $headers Header names and field values.
1519  		 */
1520  		$headers = (array) apply_filters( 'nocache_headers', $headers );
1521  	}
1522  	$headers['Last-Modified'] = false;
1523  	return $headers;
1524  }
1525  

PHP Documentation

<?php
/**
		 * Filters the cache-controlling HTTP headers that are used to prevent caching.
		 *
		 * @since 2.8.0
		 *
		 * @see wp_get_nocache_headers()
		 *
		 * @param array $headers Header names and field values.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/functions.php
Related Hooks

Related hooks will be displayed here in future updates.