File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88function purge_cache_for_url (string $ url )
99{
10- $ request_url = 'https://api.bunny.net/purge?url= ' . urlencode ($ url );
10+ $ request_url = 'https://api.bunny.net/purge?url= ' . urlencode ($ url ) . ' &async=true ' ;
1111
1212 $ response = wp_remote_post ($ request_url , [
1313 'timeout ' => 10 ,
@@ -52,5 +52,4 @@ function purge_cache_for_url(string $url)
5252 }
5353
5454 purge_cache_for_url ($ permalink );
55- purge_cache_for_url (home_url ('/sitemap.xml ' ));
5655});
Original file line number Diff line number Diff line change 1414 return $ headers ;
1515 }
1616
17+ $ url = trim ($ _SERVER ['REQUEST_URI ' ] ?? '' );
18+
1719 // never set cache headers for logged-in users
1820 if (is_user_logged_in ()) {
1921 $ headers ['Cache-Control ' ] = 'must-revalidate, max-age=0, private ' ;
2325 $ headers ['Cache-Control ' ] = 'public, s-max-age=3600, max-age=300 ' ;
2426
2527 // cache feeds and XML files (ie sitemap) for 1 day (shared) or 1 hour (browser)
26- } elseif (is_feed () || str_ends_with ($ _SERVER [ ' REQUEST_URI ' ] ?? '' , '.xml ' )) {
28+ } elseif (is_feed () || str_ends_with ($ url , '.xml ' )) {
2729 $ headers ['Cache-Control ' ] = 'public, s-max-age=86400, max-age=3600 ' ;
2830
2931 // cache all other pages for 30 days (shared) or 1 hour (browser)
You can’t perform that action at this time.
0 commit comments