• Resolved Simon Wheatley

    (@simonwheatley)


    Hi,

    Just wondering what the thinking behind WP Super Cache not caching 404 responses is? I can see no generic disadvantage to it doing so, although I suppose some themes might provide “helpful” dynamically generated 404 error pages. Perhaps a filter or option to allow caching of 404s might be handy?

    Here’s a patch I made to WPSC to allow caching of 404 requests:

    Index: /Users/simon/Projects/SF/trunk/site/wp-content/plugins/wp-super-cache/wp-cache-phase2.php
    ===================================================================
    --- /Users/simon/Projects/SF/trunk/site/wp-content/plugins/wp-super-cache/wp-cache-phase2.php	(revision 2566)
    +++ /Users/simon/Projects/SF/trunk/site/wp-content/plugins/wp-super-cache/wp-cache-phase2.php	(working copy)
    @@ -251,7 +251,7 @@
    
     	/* Mode paranoic, check for closing tags
     	 * we avoid caching incomplete files */
    -	if( $wp_cache_404 ) {
    +	if( $wp_cache_404 && !apply_filters( 'supercache_404s', true ) ) {
     		$new_cache = false;
     		$buffer .= "\n<!-- Page not cached by WP Super Cache. 404. -->\n";
     	}

    S

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘WP Super Cache doesn’t cache 404s… should it?’ is closed to new replies.