Skip to content

Commit d5a9d02

Browse files
cache sitemap for 1 day
1 parent f652b3e commit d5a9d02

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

includes/set-cache-headers.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
} elseif (is_404()) {
2020
$headers['Cache-Control'] = 'public, max-age=3600';
2121

22-
// cache all other pages for 30 days
22+
// cache feeds and XML files (ie sitemap) for 1 day
23+
} elseif (is_feed() || str_ends_with($_SERVER['REQUEST_URI'] ?? '', '.xml')) {
24+
$headers['Cache-Control'] = 'public, max-age=81600';
25+
// cache all other pages for 1 year
2326
} else {
2427
$headers['Cache-Control'] = 'public, max-age=2592000';
2528
}

0 commit comments

Comments
 (0)