LLMS_Cache_Helper::additional_nocache_headers( array $headers )

Set additional nocache headers.


Description Description

See also See also


Top ↑

Parameters Parameters

$headers

(array) (Required) Header names and field values.

  • 'Expires'
    (string) Expires header.
  • 'Cache-Control'
    (string) Cache-Control header.


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/class.llms.cache.helper.php

	public static function additional_nocache_headers( $headers ) {

		// First tree are the default ones.
		$nocache_headers_cache_control = array(
			'no-cache',
			'must-revalidate',
			'max-age=0',
			'no-store',
		);

		if ( ! empty( $headers['Cache-Control'] ) ) {
			$original_headers_cache_control = array_map( 'trim', explode( ',', $headers['Cache-Control'] ) );
			// Merge original headers with our nocache headers.
			$nocache_headers_cache_control = array_merge( $nocache_headers_cache_control, $original_headers_cache_control );
			// Avoid duplicates.
			$nocache_headers_cache_control = array_unique( $nocache_headers_cache_control );
		}

		$headers['Cache-Control'] = implode( ', ', $nocache_headers_cache_control );

		return $headers;

	}

Top ↑

Changelog Changelog

Changelog
Version Description
6.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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