Forked from Tabrisrp/rocket-dreampress-expires.php
Last active
March 3, 2017 23:12
-
-
Save charmoney/b9f99443dbb0000425fb7cba14d1d592 to your computer and use it in GitHub Desktop.
Adjust expiration on HTML to prevent WP Rocket issue with DreamPress Varnish cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('rocket_htaccess_mod_expires', 'wp_rocket_adjust_html_expire_dreampress'); | |
/** | |
* Adjust expiration on HTML to prevent issue with Varnish cache | |
* | |
* @param string $rules htaccess rules. | |
* @return Updated htaccess rules | |
*/ | |
function wp_rocket_adjust_html_expire_dreampress( $rules ) { | |
$rules = str_replace( | |
'ExpiresByType text/html "access plus 0 seconds"', | |
'ExpiresByType text/html "access plus 1 hour"', | |
$rules | |
); | |
return $rules; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment