cache_javascript_headers

Set the headers for caching for 10 days with JavaScript content type.

Description

cache_javascript_headers(); 

Usage

  1. if ( !function_exists( 'cache_javascript_headers' ) ) { 
  2. require_once ABSPATH . WPINC . '/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = cache_javascript_headers(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/functions.php  
  1. function cache_javascript_headers() { 
  2. $expiresOffset = 10 * DAY_IN_SECONDS
  3.  
  4. header( "Content-Type: text/javascript; charset=" . get_bloginfo( 'charset' ) ); 
  5. header( "Vary: Accept-Encoding" ); // Handle proxies 
  6. header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $expiresOffset ) . " GMT" );