PHP code example of alleyinteractive / wp-404-caching
1. Go to this page and download the library: Download alleyinteractive/wp-404-caching library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alleyinteractive / wp-404-caching example snippets
add_filter( 'wp_404_caching_cache_time', function( $cache_time ) {
return 2 * HOUR_IN_SECONDS; // Set cache time to 2 hours.
} );
add_filter( 'wp_404_caching_stale_cache_time', function( $stale_cache_time ) {
return 2 * DAY_IN_SECONDS; // Set stale cache time to 2 days.
} );
// Programmatically bypass the cache.
add_filter( 'wp_404_caching_enabled', '__return_false' );