Skip to content

Commit

Permalink
Merge pull request woocommerce#26802 from woocommerce/fix/25833
Browse files Browse the repository at this point in the history
introduce woocommerce_enable_nocache_headers filter
  • Loading branch information
rrennick authored Jun 23, 2020
2 parents e56ef18 + 4a9fb66 commit e9f71ac
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions includes/class-wc-cache-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,15 @@ public static function init() {
* @since 3.6.0
*/
public static function additional_nocache_headers( $headers ) {
// no-transform: Opt-out of Google weblight if page is dynamic e.g. cart/checkout. https://support.google.com/webmasters/answer/6211428?hl=en.
$headers['Cache-Control'] = 'no-transform, no-cache, no-store, must-revalidate';
/**
* Allow CDN plugins to disable nocache headers.
*
* @param bool $enable_nocache_headers Flag indicating whether to add nocache headers. Default: true.
*/
if ( apply_filters( 'woocommerce_enable_nocache_headers', true ) ) {
// no-transform: Opt-out of Google weblight. https://support.google.com/webmasters/answer/6211428?hl=en.
$headers['Cache-Control'] = 'no-transform, no-cache, no-store, must-revalidate';
}
return $headers;
}

Expand Down

0 comments on commit e9f71ac

Please sign in to comment.