Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Garconis/dd1137a6a9b185603d8a515e230d98bf to your computer and use it in GitHub Desktop.
Save Garconis/dd1137a6a9b185603d8a515e230d98bf to your computer and use it in GitHub Desktop.
Pressable | Add custom batcache settings to end of wp-config.php file
<?php
$n = '
/** Custom Batcache settings for the end of wp-config.php **/
global $batcache;
if ($batcache && WP_CACHE) {
$batcache->max_age = 86400; // Seconds the cached render of a page will be stored
$batcache->seconds = 3600; // The amount of time at least 2 people are required to visit your page for a cached render to be stored.
}
';
file_put_contents(str_replace( 'wp-content', '', WP_CONTENT_DIR).'wp-config.php',$n,FILE_APPEND);
// add this to ensure the file only runs once (before deleting itself):
// unlink(__FILE__);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment